MyBB-Plugins Forums

Full Version: Help with using NewPoints language setting in custom plugin.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi ,

Ive made a simple plugin as of now to display the NewPoints in the memberlist..even though the tweak is so small that we just need to make 2 template edits..

I still made a plugin out of when I try getting the Lang setting for what NewPoint is called on the given forums using the "newpoints" i tried using {lang->newpoints} but it kinda does not return any values..

I know im missing something...ive never tried using other langs setting in my own plugins before can u help me with it?
You must hook to memberlist_start (?) and load the NewPoints language files using the proper function.
Ive already added the hook and given the function..
"$plugins->add_hook("memberlist_start", "newpoints_memberlist_loadhook");"

How do I replace the content in the template ?? any hints on that?
What content? Don't you just want to use {$lang->newpoints} ?

I think you're making a big confusion here. Do you know PHP at least?
Yes..I know PHP Pirata..

Ill tell u what ive done till now..

In the plugin activate function...Ive written the code to change the template memberlist and memberlist_user to add the columns..

In the memberlist template in where I have added the code to add this to the template
"<td class="tcat" width="10%" align="center"><span class="smalltext"><strong>NewPoints</strong></span></td> "

Now in this case I have manually typed NewPoints there and it works fine..and if users want to change it they can go to the Memberlist template and change it but I want to automatically get the {$lang->newpoints} ..

I was able to get the Userpoints there but I could not get the Name of the currency from the Language file !!

In the addhooks ive not done nething till now..Im asking how do i replace that NewPoints in the template with the {$lang->newpoints}
First you need to add your hook (what you already did, by what I understand), then in your plugin function you load the Newpoints language file and that is it.
PHP Code:



This works fine..

I was loading the $lang->load('newpoints'); in the newpoints_memberlist_install() function and I was doing the template replace thing in the hook which was messing it up .. Sad and i was wondering why it does not work ...

Thanks Sama34 u've been a great help!!

Now I see there is another problem...

When I go the the plugins it says Install this bad boy and when I click it it works good but that Text Install this bad boy does not change to something like deactivate etc like it happens in all the other plugins have i missed something there..

These are the functions I have added right now
function newpoints_memberlist_info()
All the info codes are here the return array etc..

function newpoints_memberlist_install()
ive done the find replace templatesets thingy here it looks good..

$plugins->add_hook("memberlist_start", "newpoints_memberlist_loadhook");
function newpoints_memberlist_loadhook()
    global $lang;
//this is as you had suggested...

    function newpoints_memberlist_is_installed()
     // nothing here its blank

function newpoints_memberlist_deactivate()
//this has the code to replace the template back to normal.

    function newpoints_memberlist_uninstall()
//No codes here this is blank

and thats it!!
But it only says Install the bad boy it does not change to deactivate Sad even though when i say Uninstall the code in deactivate is run and it replaces the template back to normal ... am I missing something sama?

I think its something to do with the GUID ?? ive not given any GUID as of now ..ive got no idea how to get that...although I know I could get a GUID from a GUID Generator but would that work??
Is not "Install this bad boy" from xThreads? Probably your plugin is running an unnecessary hook somewhere and instead of trying to "fix" it you can just get rid of it.
No..there is nothing else there..And ive upgraded the mybb and all of my plugins installed there show the same "install this bad boy" text!! Sad