Exemple #1
0
	def create_blog_for_user(self, username, email, blog_id, blog_title):
		"""Create a blog for the user on a WPMU or multisite blog.

		If this function is called on a blog that is not WPMU or multisite,
		it has no effect.

		Arguments:
		username -- the user's username
		email -- the user's email address
		blog_id -- the URL stub at which the blog can be accessed
		blog_title -- the title for the new blog

		"""
		if not self.version.is_multi:
			return
		self.apply_changes(
			render_to_string('pressgang/options/create_blog.php', {
				'blog':     self,
				'blog_id':  blog_id,
				'email':    email,
				'domain':   _settings.SERVER_BASE,
				'path':     url_join(self.relative_url, "%s"),
				'title':    blog_title,
				'username': username
			})
		)
Exemple #2
0
	def installation_url(self):
		"""The absolute URL of the first-time installation page."""
		if self.version.major < 3:
			file = "index.php"
		else:
			file = "wp-admin/install.php?step=2"
		return url_join(self.url, file)
Exemple #3
0
	def add_user_url(self):
		"""The absolute URL to the add-user page."""
		return url_join(self.admin_page_url, 'user-new.php')
Exemple #4
0
	def network_activate_url(self):
		"""The network activation page URL."""
		return url_join(self.url, self._WP_NETWORK_ACTIVATION_PATH)
Exemple #5
0
	def login_url(self):
		"""The URL of the login page."""
		return url_join(self.url, self._WP_LOGIN_FILE)
Exemple #6
0
	def network_admin_page_url(self):
		"""The absolute URL to the network admin page base."""
		return url_join(self.url, 'wp-admin', 'network/')
Exemple #7
0
	def admin_page_url(self):
		"""The absolute URL to the admin page base."""
		return url_join(self.url, 'wp-admin/')
Exemple #8
0
	def relative_url(self):
		"""The URL of the blog relative to the server base."""
		address = self.path.replace(_settings.APACHE_DOCUMENT_ROOT, "")
		address = address.replace(os.sep, '/')
		return url_join(address)
Exemple #9
0
	def url(self):
		"""The URL at which the blog can be accessed."""
		return url_join("http://%s" % _settings.SERVER_BASE, self.relative_url)
Exemple #10
0
	def _visit_plugin_admin_page(self):
		"""Visits the plugin's admin page to allow it to perform sanity checks."""
		self._blog.make_admin_request(
			url_join(self._blog.admin_page_url, self._PLUGIN_PAGE_URL))