MyBB Community Forums

Full Version: I have started developing my first plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi ,

Ive started developing my first plugin ,

So far i have successfully finished Creating the required tables , creating the settings , uninstalling (drop tables and settings)

Now my second task is i need to add a new column to the memberlist template after the Username column ,

I am using this code to do it

 find_replace_templatesets("memberlist", '#'.preg_quote('<td class="tcat"><span class="smalltext"><strong>{$lang->username}</strong></span></td>').'#' , '<td class="tcat"><span class="smalltext"><strong>{$lang->username}</strong></span></td><td class="tcat"><span class="smalltext"><strong>Certifications</strong></span></td>');
This has added the New Column successfully!!

And also I checked the same replacing code to edit the memberlist_user to add the list of certifications the user has added...

I need help on how do i run a querry on the table which i created which is "certi_module"

which have these fields

cid , uid , certi_name , certi_imagepath,certi_link,certi_desc

the certi_imagepath is what i want to get in the certifications column.
it has to be something like this
I would run a querry which would be
select certi_imagepath,certi_link,certi_desc from certi_module where uid=the userid
then the certification column should show the following depending on how many rows are returned...
using a for each loop...
<a href="certi_link"><img src="certi_imagepath"/></a>

can any one guide me how to do it?

This is my first plugin..please be as descriptive as possible..

thanks in advance!!

Anyone? Bump!
Which hook you used for the function?
Ive not used any Hooks currently Sad ... should I use some? do i require them?

As I want users to have a Settings in the User Control Panel where they can add their Certifications , like MCP , Oracle etc.. where they will provide URL to Image , Link to Certification URL,Description and Certification Name. These details would be stored in the Database Table "certi_module".

This should be displayed on Member List and also their Profile Page.
Without hooks you're not able to run the functions.

To display on memberlist, use "memberlist_user" hook.
To display on profiles, use "member_profile_end" hook.
To allow users to input their data in User CP, use "usercp_start" hook.

Each hook should have its own function. try to download any exisiting plugin and see how they used hooks and their corresponding functions.