Thread Rating:
  • 12 Vote(s) - 4.58 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MyPlaza v0.5 (Beta)
#21
why do you want MYPS with it? with this, you can donate, you have a bank, you can do the same things as you do with MYPS
Reply
#22
Great plugin, but I wonder why is everyone making a plugin on his own doing the same function?, it would be great If your creativity and Labrocca's professionality could be combined in one super-duper points plugin.
Reply
#23
when i want to activate plugin

Parse error: syntax error, unexpected '=', expecting ')' in /home/forumbay/public_html/inc/plugins/myplaza/bank.php on line 364
Reply
#24
i can't find anything wrong on line 364 !?
Line 364:
PHP Code:
function bank_update_values($cur_amount null, &$user null

did you download MyPlaze 0.1.1?
Reply
#25
haXan2005 Wrote:when i want to activate plugin

Code:
MySQL error: 1060
Duplicate column name 'money'
Query: ALTER TABLE `mybb_users` ADD ( `money` decimal(10,2) NOT NULL default '10', `purchases` int(10) NOT NULL default '0' );
Do you have some other modification which uses the "money" field? If not, you may have activated MyPlaza, something screwed up, and now you have duplicate fields.

You can drop the column using the query:
Code:
ALTER TABLE mybb_users DROP 'money', DROP 'purchases';

Mamoun Wrote:Great plugin, but I wonder why is everyone making a plugin on his own doing the same function?, it would be great If your creativity and Labrocca's professionality could be combined in one super-duper points plugin.
Making own plugins? The only other plugin I'm aware of is MYPS and/or Inventory Shop.
It seems there's a misconception about MyPlaza. MyPlaza is VERY different in nature from the above two.
MyPlaza does NOT come with any items, or whatnot. MyPlaza is a framework on which items etc can be built onto.
Although it does have an AJAX based front-end, it's power lies in the back-end. MYPS and the inventory shop is mostly a front-end application, whereas MyPlaza is back-end driven.
This is why the only way they can be combined is for MYPS to be built on top of MyPlaza (something I don't think labrocca is willing to do).

If you look into this plugin, earning income is through a module/plugin built on top of MyPlaza (the Income module). This is to show that MyPlaza does not really do much by itself.

haXan2005 Wrote:when i want to activate plugin

Parse error: syntax error, unexpected '=', expecting ')' in /home/forumbay/public_html/inc/plugins/myplaza/bank.php on line 364
I don't think I can find much problem with that either, unfortunately. Can you tell me what PHP version you are running?
I'll see if I can find what the problem is.

Thanks.
Reply
#26
i'll actally like myps built into the plugin still kept the inbuilt one but make like which money system

inventory shop did it on the plugin realease candatate 2

but i need this one because its got user title change but if u dont do it i will just wait till labrooca does her plugin
Reply
#27
This user has been denied support. This user has been denied support.
Quote:Although it does have an AJAX based front-end, it's power lies in the back-end. MYPS and the inventory shop is mostly a front-end application, whereas MyPlaza is back-end driven.
This is why the only way they can be combined is for MYPS to be built on top of MyPlaza (something I don't think labrocca is willing to do).

I use mybb as my backend. And MYPS is released GNU/GPL. You are free to take the code and place whatever you want on top of it. You could have written your framework to work with myps but instead you chose to work with your own system. It's understandable but don't give the impression that MYPS is restricted in some way. MYPS is a very basic yet extensive plugin for points. I have hooks in all the right places and would add a hook upon request if one was needed.

The reason I built MYPS is to be a CORE plugin for points. Ryan did a perfect integration into his inventory shop with MYPS so it's obviously very possible to do so. There are dozens of possibilities for a forums that uses points but a point system that's open is the key to that integration. Anyone can write a plugin using MYPS and the starndard mybb plugin system. There are already a handful that exist. Looking at your code I am somewhat perplexed why you chose to create a plugin system within a plugin system. It's great code what you wrote..don't get the wrong impression. Maybe I am just not smart enough to know why a person would redo something that's already done.

I built MYPS for mybb. You are asking authors to write for MyPlaza.

Quote:but if u dont do it i will just wait till labrooca does her plugin

When did I lose my manhood? Smile
Reply
#28
labrocca Wrote:I use mybb as my backend. And MYPS is released GNU/GPL. You are free to take the code and place whatever you want on top of it. You could have written your framework to work with myps but instead you chose to work with your own system. It's understandable but don't give the impression that MYPS is restricted in some way. MYPS is a very basic yet extensive plugin for points. I have hooks in all the right places and would add a hook upon request if one was needed.

The reason I built MYPS is to be a CORE plugin for points. Ryan did a perfect integration into his inventory shop with MYPS so it's obviously very possible to do so. There are dozens of possibilities for a forums that uses points but a point system that's open is the key to that integration. Anyone can write a plugin using MYPS and the starndard mybb plugin system. There are already a handful that exist. Looking at your code I am somewhat perplexed why you chose to create a plugin system within a plugin system. It's great code what you wrote..don't get the wrong impression. Maybe I am just not smart enough to know why a person would redo something that's already done.

I built MYPS for mybb. You are asking authors to write for MyPlaza.
It's somewhat possible, but the integration would be very ugly at best.
No offense to you, MYPS is a great plugin, but I really dislike how you did some things.
For example:
PHP Code:
function myps_reply()
{
    global 
$db$mybb$fid$post$thread;

  if (
$mybb->settings['myps_status'] != "off"){
    
$myps_allow myps_allow();
    if(
$myps_allow == "yes")
    {
        
$myps_countchar my_strlen($post['message']) * $mybb->settings['myps_perchar'];
         
$addmyps $mybb->user['myps'] + $mybb->settings['myps_perreply'] + $myps_countchar;
        
$db->query("UPDATE ".TABLE_PREFIX."users SET myps='".round($addmyps$mybb->settings['myps_decimal'])."' WHERE uid='".$mybb->user['uid']."'");

    
// Begin EROP
    
$query2 $db->query("SELECT uid FROM `".TABLE_PREFIX."threads` WHERE tid='".$mybb->input['tid']."'");
    
$author $db->fetch_field($query2"uid");
        if( 
$mybb->user['uid'] != $author)
        {
            
$query3 $db->query("SELECT myps FROM `".TABLE_PREFIX."users` WHERE uid='".$author."'");
            
$author_myps $db->fetch_field($query3"myps");
            
$addauthor $author_myps $mybb->settings['myps_erop'];
            
$db->query("UPDATE ".TABLE_PREFIX."users SET myps='".$addauthor."' WHERE uid='" .$author"'");
    
// End EROP
        
}
    }
  }

There are 4 queries in the above. Compare it to how I did mine:

PHP Code:
function myplaza_post_new(&$ph) {
    
add_money('post'false);
    global 
$mybb$thread;
    
// this is if the user did a code edit to save a query
    
if(!isset($thread))
    {
        global 
$db;
        
$thread['uid'] = $db->fetch_field($db->simple_select(TABLE_PREFIX.'threads''uid''tid = '.$ph->post_insert_data['tid']), 'uid');
    }
    if(
$thread['uid'] != $mybb->user['uid'])
        
add_money('reply'false$thread['uid']);

The function add_money performs an update query, only if there is things to change (so if the admin sets the price to 0, it doesn't perform a query). (note, I recommend users perform a code edit in class-moderation.php to save that extra query when deleting posts, especially when deleting multiple posts, but I handle it if they don't).
The function uses results already done via queries in MyBB, so the function is much more optimized. Plus, I recommend using the abstractions MyBB provides, such as the $db->simple_select function rather than using your own $db->query("SELECT"), as this allows code portability.

My plugin doesn't count characters. This is because I can't think of a nice way to do so.
For example, if a user edits a post, your plugin (from what I can see in the code) does not update one's MYPS based on the new length.

There are a fair number of other flaws I see in your plugin.
PHP Code:
$plugins->add_hook('delete_post''myps_delete_reply'); 
Unless I'm missing something, I can't seem to find the hook "delete_post" anywhere in MyBB 1.2.9...
Haven't tested it, but I would assume deleting a post doesn't run the function...

There's also a few other shortcommings in your plugin, such as a few places in the AdminCP allows SQL injection. Here's one, for example:
PHP Code:
    $orderby $mybb->input['orderby'];
    
$orderdir $mybb->input['orderdir']; 
(line 281 of your admin file)
The inputs are not escaped in any way, and they are used directly in an SQL query.
Now, you may consider that admins shouldn't try and stuff up their own board, but, it's nonetheless, a security issue, if someone does manage to break into the AdminCP.

Anyways, writing an Income module doesn't take to long for me, so I find it easier to write one myself, than to probably ask you to implement everything I want.


Sorry if I've sounded too negative labrocca. I'm sure many people love your plugins, and you've certainly done a good job Smile

Anyway, plugin system within plugin system:
This is to address a few issues:
1) Bloat - MyPlaza already includes over 5 modules in a preview version. I plan to include MUCH more. Just imagine how many plugins you would have, filling up MyBB's plugin system, not to mention the MyBB Settings editor, and the number of language files
2) Speed - MyPlaza tries to reduce the need for hooking, by allowing modules to be written in a more passive manner. You can imagine how much a board can be bloated with 20+ modules installed, and MyBB constantly including those files, and forcing the PHP parser to go through and process them.
3) Quicker development - As with the above, this makes module development MUCH easier, than having to make an entire MyBB plugin - just make a _run() function, and MyPlaza will handle everything correctly. No need for a plugin developer to place hooks for some actions (although the possibility is still there)
4) Limitations of the MyBB plugin manager - not many, but primarily to allow modules to have separate settings section, which is also more customizable
5) MyPlaza specific functions - for example, Advanced Modules (allows modules to perform automatic code edits)
Reply
#29
This user has been denied support. This user has been denied support.
http://wiki.mybboard.net/index.php/MyBB_Plugin_Hooks

delete_post is there in inc/class_moderation.php

And you are right...I do have some ugly code. I am going to clean much of it up. MYPS is still in development. It's all very functional though and has no bugs. What's important is that it all works.

And I know of a way to fix the count character issue in an edit but it's going to be very complicated to do. It's on my worktable.

MYPS could certainly use some better code but to end-users...it's all functional. The extra queries you mention are near meaningless since they are only run when a reply is made. I am more worried about thread view queries myself.

Your code is certainly superior...no question about that. I just wonder if it's too complex...you are asking other authors to write plugins for your plugin. I tried to take a peek and was just baffled by all the pages you have. Ryan's inventory plugin though is perfect...he uses classes perfectly and the mybb plugin system with excellence.

I have changes for myps lined up and all your suggestions are truly appreciated. Looking at that myps_reply function I can only shake my head. It's surely not the best piece of code out there.

EDIT: Hmm...I just realized that the function I wrote includes the erop payment. That's a couple of the queries right there. How would you do that without new queries? Sorry but while you see it as extra queries in reality it's extra functions. In case you don't know what erop is...it's where the Original Poster of a thread earns MYPS for each reply.
Reply
#30
labrocca Wrote:http://wiki.mybboard.net/index.php/MyBB_Plugin_Hooks

delete_post is there in inc/class_moderation.php
Must be an error. If you can tell me which line it is on, I'll give up.

BTW, just did a test. As I thought, deleting a post, indeed, does not remove money.

labrocca Wrote:and has no bugs
I wouldn't go about making that claim Toungue
There's quite a few places where inputs are directly sent into the DB without escaping. Though I have been unable to do any SQL injections (not too sure why, it seems that PHP's function for sending queries has protection against using packing multiple queries in a single statement).

labrocca Wrote:The extra queries you mention are near meaningless since they are only run when a reply is made.
Which is why I prefer different style of coding I guess. I try to optimize most things as much as possible.
I could reduce a few more queries by using shutdown queries, but I couldn't be bothered with it...

labrocca Wrote:Your code is certainly superior...no question about that. I just wonder if it's too complex...you are asking other authors to write plugins for your plugin. I tried to take a peek and was just baffled by all the pages you have.
I believe the simpledemo.php is fairly basic - if you know how to make a MyBB plugin, you should have no issues with understanding it.
PHP Code:
<?php
/*****************************************************************************
 *   Simple Demo Module (/inc/plugins/myplaza/simpledemo.php)
 *     - MyPlaza v0.1 for MyBB 1.2
 *    By ZiNgA BuRgA, 2007
 * 
 * A simple demo of a basic MyPlaza module in under 50 lines of code :P
 *  Adds an item which adds 1000 to the current user's post count
 ***************************************************************************​**/

// basically the same as a normal plugin
//  include this function, and specify your module's details
function simpledemo_info() {
    return array(
        
"name"            => "Simple Demo Module",
        
"description"    => "Demo module - shows the basic structure of how to make a module for MyPlaza",
        
"website"        => "http://yourwebsite.com/",
        
"author"        => "Your name here",
        
"authorsite"    => "http://authorwebsite.com/",
        
"version"        => "1.0",
    );
}

// add your items in the _activate() function
function simpledemo_activate() {
    
myplaza_add_item(array(
        
"name" => 'Add 1000 to post count',
        
"description" => 'Adds 1000 to your post count.',
        
"cost" => 10.00,
    ));
}

// remove all items we added earlier in the _deactivate() function
function simpledemo_deactivate() {
    
myplaza_remove_module_items();
}

// this function handles what is done when buying an item
function simpledemo_run($item) {
    
// add 1000 to the user's post count :)
    
global $mybb$db;
    
$db->query("UPDATE ".TABLE_PREFIX."users
        SET postnum = postnum + 1000
        WHERE uid='"
.intval($mybb->user['uid'])."'");
    
    
// everything successful, so return true
    
return true;
}
?>
I think that's fairly simple, especially, since, for less than 50 lines of code, you get a nice AJAX interface, CSRF protection etc in it.
demo.php and amdemo.php should be figureable if you have more in-depth knowledge of PHP.
I wouldn't recommend trying to figure out how MyPlaza works by looking at my modules (income.php, bank.php and donate.php). I'm somewhat lazy in the commenting department.
I also try to allow for simple modules, like the above, and more complex ones, such as a bank system, and an upcoming inventory system (almost done).

labrocca Wrote:Ryan's inventory plugin though is perfect...he uses classes perfectly and the mybb plugin system with excellence.
Whether you like classes is up to you. I find it generally to convoluted, especially with PHP, as it's implementation of classes is pretty bad at best (okay, it supports inheritance, but otherwise, it's pretty bad).


labrocca Wrote:EDIT: Hmm...I just realized that the function I wrote includes the erop payment. That's a couple of the queries right there. How would you do that without new queries? Sorry but while you see it as extra queries in reality it's extra functions. In case you don't know what erop is...it's where the Original Poster of a thread earns MYPS for each reply.
Mine does as well - look at the above code (excepted here):
PHP Code:
if($thread['uid'] != $mybb->user['uid'])
        
add_money('reply'false$thread['uid']) 
Checks to see if the thread was created by a different user than the posting user - if it is, it adds money to the owner of the thread ($thread['uid'])


Anyways, I'm anxious to see an improved MYPS labrocca - keep it up! It's nice to see what people can come up with Smile
Also, thanks for the criticisms - I'll think about trying to make things easier to understand (I plan to do so with some documentation in later versions).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)