Go to

Categories overview

Authors (Paid Addon)

The Authors extension allows users to register and manage their profiles and ads in the frontend.

By registering users create a public profile which can be viewed by other users. On the profile page, the user can show his active ads, share information about his company and display a contact form.

Installation and Activation

The first step is to get the Authors zip file. If you have not purchased the extension yet, you can do that there.

Once you have it go to wp-admin / Plugins / Add New / Upload panel and upload it and activate from there.

Configuration

The configuration panel is available in wp-admin / Classifieds / Options / Authors, you should see there a screen similar to the one below.

There are following configuration options:

Default Author Register Page – If you want your Authors to be able to register themselves, then you can select here a default page with [adverts_author_register] shortcode.

By default this page does not exist so you will need to go to wp-admin / Pages / Add New panel create a page from there and make sure to include the [adverts_author_register] shortcode in the content. Finally, you can come back to the Authors configuration and in “Default Author Register Page” select the previously created page.

Default Privacy – Allows you to set default visibility for the Author page after registration. Selecting “private” will make the advert profile hidden and he will need to make it public from the page with [adverts_authors_manage] shortcode in Privacy Settings panel.

Privacy Settings – Checking this checkbox will allow uthe ser to select on registration if his profile should be private or public. If unchecked the the value from Default Privacy will be used.

Default Author Dashboard Page – similarly as above it allows setting a  default page with [adverts_author_manage] shortcode. The [adverts_authors_manage] shortcode allows the user to manage his account (edit profile, manage ads, change the password, delete an account and manage privacy settings).

This page also does not exist by default and you need to create it as explained above and then assign to this field.

Unsigned Users – only logged in users can see the dashboard panel. In this field, you can decide what happens when non-registered user will try to access one of the dashboard panels.

  • will see a login form – the users will see a login form which will allow them to login to the user dashboard.
  • error message with a link to the wp-login page – the users will see a message informing them they need to login to see this page and a link to the default WordPress login form.

The first option might provide much better user experience, but the second one should allow integrating with some social login plugins.

Defaults Values For [adverts_authors_list] – here you can set up default values for the [adverts_authors_list] shortcode.

This shortcode looks and behaves similarly to the [adverts_list] shortcode and uses the same params, so you can find out what all of those options do in the [adverts_list] documentation.

The shortcode itself will be described in more details later in this article.

Shortcodes

The WPAdverts Authors extensions is bundled with a couple of shortcodes you can use (usually) in wp-admin / Pages.

[adverts_authors_list]

this shortcode is pretty similar to the [adverts_list] in terms of look and feel and the accepted parameters.

[adverts_authors_list] in grid mode

[adverts_authors_list] in list mode.

To find out what parameters are available you can simply refer to the [adverts_list] documentation.

This shortcode is using two template files which you can override using adverts_load_template filter:

  • wpadverts-authors/templates/authors-list.php – displays search form and includes the template with individual list items.
  • wpadverts-authors/templates/authors-list-item.php – displays individual listing.

 

[adverts_author_register]

Allows users to register a profile on site.

[adverts_author_register] shortcode.

This shortcode does not have any parameters.

This shortcode is using only the default wpadverts/templates/form.php template file.

[adverts_author_manage]

From the page with this shortcode users can manage their accounts.

[adverts_authors_manage] shortcode showing the user dashboard.

There is a number of items in the menu:

  • Dashboard (name: home) – The user dashboard with some basic information.
  • Create Ad (name: create-ad) – Show the [adverts_add] shortcode and allows to post an Ad from from user dashboard.
  • My Ads (name: my-ads) – The list of user Ads. This page uses [adverts_manage] shortcode.
  • Edit Profile (name: edit-account) – Allows editing user profile.
  • Privacy Settings (name: privacy) – Here user can hide his profile from other users and change his profile page slug.
  • Change Password (name: change-password) – Here user can change his account password
  • Delete Account (name: delete-account) – Here user can delete his account.
  • Logout (name: logout) – Logouts and redirects the user.

The shortcode has the following parameters:

  • panel – (default: home) the panel to show when no panel is selected.
  • show_menu – (default: 1) if you want to hide the menu on the left side then set show_menu to 0.
  • links – (default: null) this param allows selecting which items in the menu you want to show. The list of items should be separated by a comma.

The menu items in the left sidebar can be further extended using filter adverts_authors_dashboard_menu. Adding the items to the menu requires some PHP knowledge. If you are familiar with PHP you can learn how to add, edit and delete the menu items in the Change Author Menu snippet.

This shortcode is using template files which can be changed using adverts_load_template filter:

  • wpadverts-authors/templates/dashboard.php – this is dashboard wrapper, it is being used on all of the pages to display the menu on the left.
  • wpadverts-authors/templates/panel-default.php – this template is used when viewing the Dashboard page.

Example Usage

Dashboard with left menu and Dashboard, My Ads and Logout links only.

[adverts_author_manage show_menu="1" links="home,my-ads,logout"]

 

Widget – Author Menu

If you decide to use the [adverts_author_manage] shortcode with show_menu=0 parameter then you can display the menu in the widget using “Author Menu” widget. You can also use this widget if you would like to have the Author Menu always visible.

Using it is as simple as using any other Widget, just go to wp-admin / Appearance / Widgets panel and add the “WPAdverts Author Menu” widget to the selected sidebar.

It should look like on the image below

Integrations

WPAdverts ReCAPTCHA 

If you have this plugin enabled then from wp-admin / Classifieds / Options / reCAPTCHA panel you can enable reCAPTCHA for the Authors plugin.

You should see there two additional options:

Authors – Register & Profile – allows enabling reCAPTCHA in [adverts_author_register] and in [adverts_author_manage] / Edit Profile panel.

NOTE: If you want to show the reCAPTCHA in the registration form but not when editing a profile then in field “Authors – Register & Profile” select “Enable for Unregistered users“.

Authors – Contact Form – allows enabling reCAPTCHA in the contact form on the Author details page.

 

WPAdverts Custom Fields

If you have this plugin enabled then from wp-admin / Classifieds / Options / Custom Fields panel you can create custom form schemes for:

  • Author – Profile: create advert form visible in [adverts_author_register] and in [adverts_author_manage] / Edit Profile.
  • Author – Search: search form in the [adverts_authors_list] shortcode.
  • Author – Contact: contact form visible on the Author details page.

 

WPAdverts Maps and Locations 

If you have this plugin enabled then the Location field in [adverts_author_register] and [adverts_author_manage] / Edit Profile will behave exactly the same as the location in [adverts_add] shortcode.

Emails Module

Since version 1.1.0 the Authors extension can integrate with WPAdverts Emails Module introduced in version 1.3.0. The integration is enabled by default if both Authors and Emails module is enabled.

The Authors – Emails integration add a following email templates in wp-admin / Classifieds / Options / Emails panel.

authors::on_register_notify_user

This message is sent as a confirmation to the user just registered on-site using [adverts_author_register] shortcode.

Available variables: {$user}, {$author}, {$form}, {$user_panel_url}, {$site_url}

{$user_panel_url} – URL to a page with [adverts_authors_panel] or empty if the ID of a page with the shortcode is not set in Authors settings
{$site_url} – The full site URL.

authors::on_register_notify_admin

This message is sent to the administrator to inform him that a new user registered using [adverts_author_register] shortcode.

Available variables: {$user}, {$author}, {$form}, {$admin_email}

authors::on_contact_form_sent

This message is sent when a user sends a message to an author from Author details page.

Available variables: {$user}, {$user_current} {$author}, {$form}

Variables

{$user}

This is the WP_User object connected to the {$author}, in other words this is the WP_User who created the {$author} post.

The {$user} variable has the following properties

{$user.ID}                        - User ID
{$user.data.user_login}           - User login name
{$user.data.user_pass}            - User password (hashed) 
{$user.data.user_nicename}        - URL friendly user name
{$user.data.user_email}           - User email      
{$user.data.user_url}             - User URL 
{$user.data.user_registered} -    - User registration date
{$user.data.user_activation_key}  - For WordPress only
{$user.data.user_status}          - Deprecated
{$user.data.display_name}         - The publicly displayed user name
// WP_User has a magic __get() method which allows 
// accessing meta fields as {$user.meta_field_name}
// the default meta fields are
{$user.description}
{$user.first_name}
{$user.last_name}
{$user.rich_editing}
// and any other meta_key registered in wp_usermeta table.
{$user_current}

This is the same variable as {$user} except, it is a WP_User object for currently logged in user (NOT the user connected to {$author) or in other words the user who submitted the contact form.

{$author}

This is basically a WP_Post object so you can access the same properties as in the WP_Post and the properties will return values formatted as in WP_Post

{$author.ID}                   (int)    - The ID of the post
{$author.post_author}          (string) - The post author's user ID (numeric string)
{$author.post_name}            (string) - The post's slug
{$author.post_type}            (string) - Post Type in this case it is always 'advert'
{$author.post_title}           (string) - The title of the post
{$author.post_date}            (string) - Format: 0000-00-00 00:00:00
{$author.post_date_gmt}        (string) - Format: 0000-00-00 00:00:00
{$author.post_content}         (string) - The full content of the post
{$author.post_excerpt}         (string) - User-defined post excerpt
{$author.post_status}          (string) - Usually one of: publish, draft, expired, pending
{$author.comment_status}       (string) - One of: open, closed
{$author.ping_status}          (string) - One of: open, closed
{$author.post_password}        (string) - Returns empty string if no password
{$author.post_parent}          (int)    - Parent Post ID (default 0)
{$author.post_modified}        (string) - Format: 0000-00-00 00:00:00
{$author.post_modified_gmt}    (string) - Format: 0000-00-00 00:00:00
{$author.comment_count}        (int)    - Number of comments on post (numeric string)
{$author.menu_order}           (int)    - If greater than 0 the post is featured

The {$author} variable is pretty much the same as {$advert} variable that is the same filters can be applied to it and you can get the meta fields in the same way.

{$form}

An array of values from the submitted form, in other words, the values user entered in the form before submitting it.

Depending on which form this is and how it was modified this variable will have different values but by default the values are:

// Contact Form
{$form.message_name}     - Your Name
{$form.message_email}    - Your Email
{$form.message_subject}  - Message Subject
{$form.message_body}     - The Message Body

// Registration Form
{$form.user_name}        - Author Name
{$form.user_email}       - Author Email 
{$form.user_phone}       - Author Phone 
{$form.user_publicname}  - Author Public Name 
{$form.user_slogan}      - Slogan
{$form.user_description} - Description
{$form.user_location}    - Location

 

Was this article helpful?