Hello There, Guest! › Register

Hide Content 1.4 released.
Looking for a custom plugin for your site? Ask here for a quote.

Newpoints plugin basics

(11-30-2012, 06:26 AM)Cyberuben Wrote: That's quite stupid, I admit. I just tried to see if I could echo anything, but one reason to not use templates, correct me if I'm wrong, is because I've read that http://php.net/manual/en/function.eval.php should always be avoided because of it being harmful.
Don't be ignorant. That's what makes people stupid. eval can be harmful if used improperly. MyBB uses it for templates and we make sure PHP is not "injected" into them, that's why you get "security errors" when entering invalid template code in your Admin panel.

(11-30-2012, 06:26 AM)Cyberuben Wrote: Then, what doesn't make sense to me, is that I have a file, called "buy.php", a "buy credit plugin" that allows users to purchase points for Newpoints. There, I added some features like a "disclaimer", changed all of the text, added formatting for the numbers, added a tool to move the forum-newpoints to my server, using MySQL, where the users can purchase hats and such with it.

There, they do the following:
<title>{$mybb->settings[bbname]} - ".$lang->sprintf($lang->buycredit_title, $name)."</title>
<style type=\"text/css\">
#donatenav {
    color: #ffff00;
<body id=\"donate\">

Just as example.

Now, in my newpoints plugin, I'm trying to do the same:
function newpoints_vipstatus($page)
    global $mybb, $db, $lang, $cache, $theme, $header, $templates, $plugins, $headerinclude, $footer, $options, $inline_errors;
    $page = '<html>
    <title>{$lang->newpoints} - {$lang->newpoints_subscriptions}</title>
    <table width="100%" border="0" align="center">
    <td valign="top" width="180">
    <table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
    <td class="thead"><strong>{$lang->newpoints_menu}</strong></td>
    <td valign="top">

I copied this code from subscriptions (it's a template-copy, but the buy.php doesn't use templates either and it works there), just to see if it works, but apparently this isn't possible because this is a plugin, and not a page.
I'm getting the following output:
http://puu.sh/1vHEx, and on the page itself: http://puu.sh/1vHEQ
I am sure you remember when you learned PHP that variables are not parsed when using single quotes.

(11-30-2012, 06:26 AM)Cyberuben Wrote: It's just really frustrating that I can't find out how to get it to work. I'm really easy with picking things up such as this, this is how I learnt PHP. Started doing simple tasks my dad gave me and I kept expanding. I can write some decent systems with "security" built in and such, but MyBB is just one blank sheet of paper, there's nothing that makes it clear for me. I don't understand how they accomplished to write a whole system where developers have to find out MyBB's way of doing stuff, without any form of documentation, not looking at the bad snippets on their website where not even a hyperlink works.
Because it's easy, perhaps? It's not out fault that you haven't realized that you are using single quotes instead of double quotes.

(11-30-2012, 07:32 AM)Cyberuben Wrote: I understand that I'm a pain in the ass, but once I get it, it'll be no deal. I just need a push in the right direction.

Sorry for doubleposting, was an accident. Thought post-merge time was a little longer.
I didn't stop replying, I just got home. Just be patient Smile

(11-30-2012, 07:32 AM)Cyberuben Wrote: EDIT:
Could you help me to set this up? I just need a basic example how to alter the page that's being put out, with the menu on the left. I'm willing to pay you $10 if you can write me a small tutorial, templates would be nice. Even if the output is only "Test".
I don't need money. You're going to learn it this way, trust me. You don't need better examples than you have been provided right now.
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.

Excuse me for my stupidness with the quotes, I didn't even notice since I was more looking at the hooks rather than the variable (because it worked somewhere else). Also, apparently it shows the following:
Should I use "if($mybb->input['action'] == "vipstatus") {}" or is there something else I have to do?

And in reply to your previous post, I didn't post again to make you reply, I just thought auto-merge would work, which doesn't "bump" my post, but apparently it did. On my forum merge-time is one day.

I just found the answer already.

OK post here if you need help within the same topic Smile
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.

Users browsing this thread: 1 Guest(s)