logo epowerpress.com
Submit Website Manage Directory Listings Edit Profile
Home | General Posts |

ePowerPress plugin calls and hooks


List of available hooks and calls for ePowerPress



Important note


Like explained in How to code ePowerPress plugin , always identify your plugin with a unique name, and if you want to use database tables, then also identify their key in $table array with your plugin name.


The function that ePowerPress will look for will be:
{Your_Plugin_Name}_{function}
Say for example, if your plugin is named "myPlugin", and you want to use the "_login" call below, then your PHP function must be:
myPlugin_login


Some plugin calls have parameters passed to them, in which case your plugin function must also be able to accept the parameter. Failure to do so might result in a fatal error thrown by PHP.
For example, "_verifyEmail" has an numeric ID passed to it, therefore your function must be declared like this:

function myPlugin_verifyEmail( $id=0 ){

//code of function here

}



List of plugin calls and what they do


Please note that only "_loadShow{type}" functions must return an output.
Other functions should write to global variables like "$co", "$pt", "$meta", "$side", etc.


"_login"
Called when a member is successfully logged in
Member will be redirected to dashboard after this
Info about the member is available in $_SESSION, no parameters are passed

"_register"
Called when a member registers and creates an account on the website
No parameters are passed. Info about registered member is available in $_SESSION
Info submitted by user is available in $_POST also

"_registerForm"
Called just before showing terms of use link and "REGISTER" button.
Use this to add form fields to registration form.
No parameters given here


"_verifyEmail"
Called when user clicks the verification link sent in email and comes to the website to verify email.
Called only when email is successfully verified.
ID of registered member is given as parameter.


"_dashMenu"
Called as soon as a logged in member opens their dashboard
Use this to show dashboard menu links, reports, order history etc.
Info of logged in member is available in $_SESSION
No parameters.


"_loadShowPost"
Function executed whenever a blog post is processed for output.
Note, if you are using this, then you should also use "_loadShowForum", in case user has set ePowerPress to work as a forum. In this case "_loadShowForum" will be called and not this one.
You can use this to add certain things at the bottom of each post or comment, like a link or some other options.
Your function should return the string to be displayed as a variable.
Takes 1 parameter, an array, which has lots of info about the post itself, like ID of post (pid), ID of member (custid), username of member (username), any attached files etc. print_r the array to see all the info available.
Note, if you used a custom query, like in dashboard, then this array will be different based on what your query selected.


"_loadShowForum"
Called when user is running ePowerPress as a forum, and not as a blog.
Same array is passed as parameter, and output of this function is shown in 4th column of the forum table.
Your function should return the string to be displayed as a variable.


"_loadShowDir"
Executed for each directory listing showed.
Takes an array as parameter, has ID (pid), URL (url), Short Description (sdesc), TITLE (title), are in the array.
Can be used to show a button etc just below the listing. Clicking the button can activate other tracking or logging javascript functions
Your function should return the string to be displayed as a variable.


"_loadShowPage"
Executed for each page in Manage Pages section
Use this to show additional info to admins, or to show option links to admins
Takes an array as argument parameter which has information about the page, like ID of page (pid), title of page etc.
Your function should return the string to be displayed as a variable.


"_loadShowMember"
This is called when loading side menu notifications of a logged in member. When coding for this plugin call, always check "$_SESSION" to check if a member is logged in or not.
An array is passed to the function which has ID of logged in member.
Can be used to display status of latest orders placed by a website user, or handful of inbox messages etc.


"_adminForm"
Creates a form field in the admin settings form.
Data will be saved in site.config.txt file on submit
No parameters
Important note, when saving data to site.config.txt file using a plugin, then make sure to validate the data when you read it back. Never save raw HTML in this file to dump somewhere in the displayed browser HTML later.
Data saved in this file is later available in "$rv" with the same key as was used in the form field.


"_manageUserForm"
Creates a form field in the manage member area for moderators.
No parameters

"_manageUserAction"
Called when moderator submits the form in manage member area.
Function passes ID of customer to manage, and STAT (status) set by moderator.
Use this to deactivate or activate certain other settings for this user. STAT is a single character "y/n".


"_ratingsAddOn"
Called when a vote up or vote down type basic reaction is given to a post.
Function takes 3 parameters, ID, Reaction (0/1), array with post ID and custid of member who created the post or comment.


"_ratingsUrlAddOn"
Called when a like or dislike rating is given to a directory listing.
Function takes 2 parameters, ID of directory listing, and rating (0/1)
1 is for positive rating, 0 is for negative


"_blockAddOn"
Called when a member blocks another member.
Function takes 1 parameter, ID (custid) of the blocked user.
Info about logged in member is in $_SESSION


"_unblockAddOn"
Called when a member unblocks another member previously blocked
Function takes ID (custid) as parameter
Info of logged in member is in $_SESSION


"_dashAddOn"
Plugin for dashboard before dashboard content is loaded for logged in member
Takes no parameters
Can be used to erase or replace the query used to pull out data from database.
Query is in the variable "$dashSQL"


"_homepageTop"
Called just before loading latest posts by admin on homepage.
Can be used to showcase some ads or products etc in an ecommerce plugin
No parameters


"_homepageBottom"
Called just after member posts are loaded on homepage
No parameters


"_newListing"
Called after a new listing is submitted to directory
ID of the new listing is given as parameter.
Other info is available in $_POST


"_newListingForm"
Adds a form field to directory submission form
No parameters


"_editListing"
Called when an existing directory listing is editted
ID of listing is given as parameter
Status of listing has already changed if title, description, or URL is changed.
Use this to edit and save some extra settings
Note, if member editted their bid or balance, then they will be redirected to payment page soon after this.


"_editListingForm"
Adds a form field to edit existing directory listing form
ID of listing is given as parameter.


"_newPostAddOn"
Called as soon as a new post is added to database
ID of new post and ParentID are 2 parameters given to function
ParentID will be zero if this is a new post, but will be greater than zero in case of a comment.
Do not redirect the user anywhere in this function, since core processing still remains.


"_newPostTagAddOn"
Called immediately after tags are added to database for a new post
An array with valid tags is sent as parameter
Again, do not redirect user, processing still remains


"_createPageFormSubmit"
Called when a new landing page is added to database.
ID of new page is given as parameter.


"_createPageForm"
Add a form field to landing page creation/editting form
An array is sent as parameter.
This array will have empty values like a non numeric 'pid' if this is a new page create form.
It will have a numeric page ID if user is editting an existing page.
More values are there in the array like title, promo key, description, etc.


"_deleteData"
Called when delete tracking data of existing landing page
ID of page is given as parameter.


"_deletePage"
Called when a landing page itself is deleted.
ID of page is sent as parameter.

"_statPageLinks"
Use this to show option links to admins when they are viewing stats of a landing page.
ID of page is given as parameter.


"_loadPage"
Called when a landing page is being viewed by a website visitor
ID of page is given as parameter.


"_modePaymentAddOn"
To show payment options on payment form.
In this plugin, simply create a "submit" button with "submit" as name and use "pay with {processor name}" as value of this button.
Then in the below plugin, check the value of button pressed by user, and then redirect to appropriate processor.
Something like this:
function myPlugin_modePaymentAddOn(){
global $co;
$co.='<input type="submit" name="submit" value="Pay using Credit Card" />';
}//function ends



"_makePaymentAddOn"
Called when user has clicked "make payment" or "checkout" button and selected a particular processor button.
No parameters are passed here
Data is stored in $_SESSION['pr']
'pr' is short for product
This is the same plugin that other plugins can also use when processing payments.
Basically redirects to the website of payment processor
Information about selected payment processor is in $_POST
I am using this for directory submission payments via paypal.
If you develop a plugin which inturn wants to use this payment plugin, then provide following details in $_SESSION['pr'] array:

array(
'id'=> 123 (numeric ID of order in database)
'stat'=> 'y/n/p/d' etc (Status of order in database)
'c'=> 'xyz' (a custom identifier for this order, probably validated on successful payment page, some processors return this value in querystring, some post it)
'balance'=> 11.00 (amount to be paid)
'payFor'=> 'DirectoryListing' (identify the plugin/product here, ecommerce, directory, etc, so other plugins know which database table is to be updated on successful payment)
)

You can add other info as well, but at least provide this much


"_postAddOn"
Called when user is viewing a particular post or forum thread.
An array is passed as parameter which has info about the primary post.
Note, difference in this plugin and in "_loadShowPost" is that this one is called only for the primary post, while "_loadShowPost" is called for each comment or short description of the post on different pages.
This plugin can be used to lock a particular post or hide all comments without deleting them from database.
To lock a post, set a value for "$rv['hidePostBox']", any value.
To hide existing comments, set $rv['allowComments']='no'
You can use this plugin to show additional moderator links, or just more options for users, like "add a public poll" option using your plugin.


"_editPostAddOn"
Called when user edits their post or comment
ID of post or comment is given as parameter.


"_editProfileAddOn"
Called when user is editting his own profile
No parameters are given. Member info is available in $_SESSION, and data posted is available in $_POST


"_editProfileForm"
Called just before submit button is displayed on profile edit form.
Use this to add more form fields to edit profile section.


"_profileAddOn"
Called on a profile page itself.
Use this to add more options to a profile page of a member
This is the plugin that AtHashPal uses to show Top Fans on a profile page.
An array is available with user information as parameter


"_search"
Called on search page when user has submitted the search form
ePowerPress already shows matching blog posts, and this plugin call is made before starting the search for blog posts.
You can use this to show a handful of other things, like matching products from your ecommerce plugin along with a link to view more products.
No Parameters are given here. Search term is in the URL, which can be accessed using global variable "$load[1]"


"_tagAddOn"
Called when user is browsing a tag page.
Can be used to show a handful of products related to a tag via your ecommerce plugin along with a link to view more products.
No parameters. Tag is in the URL, can be accessed via global variable "$load[1]"


"_sideMenuTop"
Called before loading navigation menu.
Use this to add custom options to global variable "$side", which is the variable which stores all navigation later.
Do not overwrite the variable at any time. Simply add to it.


"_sideMenuUser"
Called in navigation itself, just after showing user notifications.
No parameters given.
Use the $_SESSION to make sure a member is logged in.


"_sideMenuBottom"
Called in navigation itself, but at the bottom instead of on top.
No parameters.

You might also be interested in :

Share on AtHashPal Reddit Digg LinkedIn StumbleUpon -->
Share on AtHashPal Reddit Digg LinkedIn StumbleUpon -->
Share on AtHashPal Reddit Digg LinkedIn StumbleUpon -->