PHP Scripts Development » bbpress plugins and modifications

New plugin: Moderator Notification

(21 posts)

Great offers not only for geeks!


  1. My first plugin for bbpress:

    Moderator New Post Notification

    Description:
    Sends a notification e-mail to all moderators and admins if there is a new post from a regular member.

    Enjoy and let me know what do you think.

    Posted 8 months ago #
  2. The plugin is listed now on the bbpress website:

    http://bbpress.org/plugins/topic/75?replies=1

    don't forget to vote

    Posted 7 months ago #
  3. User has not uploaded an avatar

    paulf
    Member

    I got this installed and I don't get any emails. New users are receiving their emails, but I don't get notifications when anyone posts.

    What could be wrong?

    Posted 1 month ago #
  4. Hi,

    what is your role on your forum? do you tried a second (admin) account?

    Posted 1 month ago #
  5. User has not uploaded an avatar

    Erdna
    Member

    Hi, I have a stand alone installation of bbpress and when I use the plugin I get this error:

    bbPress database error: [Table 'db164673748.bb_users' doesn't exist]
    SELECT um.meta_value AS role FROM bb_users AS u, bb_usermeta AS um WHERE u.ID = um.user_id AND um.meta_key = 'bbpress_capabilities' AND u.user_status = 0 AND u.ID = 1

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /homepages/34/d21941373/htdocs/forum/my-plugins/moderator_notification.php on line 40

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /homepages/34/d21941373/htdocs/forum/my-plugins/moderator_notification.php on line 40

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /homepages/34/d21941373/htdocs/forum/my-plugins/moderator_notification.php on line 40

    Warning: Invalid argument supplied for foreach() in /homepages/34/d21941373/htdocs/forum/my-plugins/moderator_notification.php on line 73

    Warning: Cannot modify header information - headers already sent by (output started at /homepages/34/d21941373/htdocs/forum/bb-includes/db-mysql.php:130) in /homepages/34/d21941373/htdocs/forum/bb-includes/pluggable.php on line 228

    I have read the suggestions, but I still habe no solution for this. Can you help me?

    Posted 2 weeks ago #
  6. I guess you trapped into the table name bug :)

    I guess your user table is not bb_user?

    Posted 2 weeks ago #
  7. User has not uploaded an avatar

    Erdna
    Member

    Well, you are right. My tables name was different.. I changed it, but now I have a different error:

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /homepages/34/d21941373/htdocs/forum/my-plugins/moderator_notification.php on line 40

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /homepages/34/d21941373/htdocs/forum/my-plugins/moderator_notification.php on line 40

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /homepages/34/d21941373/htdocs/forum/my-plugins/moderator_notification.php on line 40

    Warning: Invalid argument supplied for foreach() in /homepages/34/d21941373/htdocs/forum/my-plugins/moderator_notification.php on line 73

    Warning: Cannot modify header information - headers already sent by (output started at /homepages/34/d21941373/htdocs/forum/my-plugins/moderator_notification.php:40) in /homepages/34/d21941373/htdocs/forum/bb-includes/pluggable.php on line 228

    Posted 2 weeks ago #
  8. first be sure that you have this query in your plugin.

    (echo the sql statement, access the plugin file directly and test the output with phpmyadmin) I hope that I don't ask too much ;)

    Posted 2 weeks ago #
  9. User has not uploaded an avatar

    Erdna
    Member

    I am Sorry, I don't know how to test the plugin with phpmyadmin. I located the term "array_key_exists()" in \bb_includes\template-functions.php, upgrade-functions.php, profile-edit.php and gettext.php.

    Posted 2 weeks ago #
  10. Look, I think you get this error because of an empty array, if you test the SQL statement you know the problem.

    btw. I forgot to post the modified function:

    function is_moderator($user_id) {
    	global $bbdb;
    	$mods = array('moderator', 'administrator', 'keymaster');
    	$is_mod = false;
    	$row = $bbdb->get_row("SELECT um.meta_value AS role
    		FROM $bbdb->users AS u, $bbdb->usermeta AS um
    		WHERE u.ID = um.user_id
    		AND um.meta_key = 'bb_capabilities'
    		AND u.user_status = 0
    		AND u.ID = $user_id
    	");
    	$arr = unserialize($row->role);
    	if (count($mods) > 0) {
    		foreach($mods as $val) {
    			if (array_key_exists($val, $arr)) {
    				$is_mod = true;
    				break;
    			}
    		}
    	}
    	return $is_mod;
    }
    Posted 2 weeks ago #

RSS feed for this topic

Reply »

You must log in to post.