MyBB Community Forums

Full Version: Social Groups 2.1 Now with SEO Support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hmm.. 2.0's Admin Module gives me an Internal Server Error (500)

Might be worth looking at Smile

Awesome job with the plugin!

Hmm.. Also, when you create a new group it returns a SQL error:
SQL Error:
1054 - Unknown column 'logo' in 'field list'
Query:
INSERT INTO tablename_socialgroups (`privacy`,`joinoptions`,`name`,`cid`,`logo`,`uid`,`description`,`announcement`,`leader`,`numdisc`,`memberids`) VALUES ('0','0','test group','1','','1','testing the new social groups plugin','test','Username','0','1')
Same issue trying to modify the code for my needs but its outputting a few errors :/
(2014-07-02, 06:01 PM)dragonexpert Wrote: [ -> ]Categories have permissions as to who can view that category. Perhaps use that category cache? We can also add a column to calendars for categories to accomplish this.
function socialgroups_calendar()
{
global $mybb, $db, $calendar;
require_once MYBB_ROOT . "/inc/class_socialgroups.php";
$socialgroups = new socialgroups();
$viewablecategories = $socialgroups->get_viewable_categories($mybb->user['usergroup'], $mybb->user['additionalgroups']);
if(!in_array($calendar['category'], $viewablecategories))
{
error_no_permission();
}
// something else
}

I guess the issue is when people access the cal directly and not through groups, some groups may want to keep their cal private.

Just wondering your opinion on changing parsing the output with pre_page_output to parse in permissions, and what you think that would mean to additional memory usage?

I mean potentially parsing the entire page each time to display content could end up being a real memory pig
Thought I had logo added in the _install function. I'll upload a fix for that in a little while. To fix that run this query:
ALTER TABLE mybb_socialgroups ADD logo TEXT
I updated the zip file on the mods site. I have no idea how you get a 500 Internal Error on the Admin Page. I did a diff between the content in my zip file and the copy on my test site and they are identical. Check your error log and see what it says.


Quote:I guess the issue is when people access the cal directly and not through groups, some groups may want to keep their cal private.

So are you suggesting a new table for group calendars?

Quote:Just wondering your opinion on changing parsing the output with pre_page_output to parse in permissions, and what you think that would mean to additional memory usage?

I mean potentially parsing the entire page each time to display content could end up being a real memory pig

You can't use post_output_page as the hook because by that time the content is already sent to the browser. It only does the parsing if you have the SEO Urls enabled. If you don't, it won't execute them.
I get this error when there aren't any groups yet:
Quote:Warning [2] array_slice() expects parameter 1 to be array, boolean given - Line: 108 - File: admin/modules/user/social_groups.php PHP 5.3.28 (Linux)
File Line Function
[PHP] errorHandler->error
/admin/modules/user/social_groups.php 108 array_slice
/admin/modules/user/social_groups.php 50 socialgroups_browse
/admin/index.php 572 require
Warning [2] Invalid argument supplied for foreach() - Line: 115 - File: admin/modules/user/social_groups.php PHP 5.3.28 (Linux)
File Line Function
/admin/modules/user/social_groups.php 115 errorHandler->error
/admin/modules/user/social_groups.php 50 socialgroups_browse
/admin/index.php 572 require
When I go to: Admin CP -> Users & Groups -> Social Groups

If there aren't any groups, shouldn't the plugin (neatly) handle the empty array instead of spitting out errors and/or warnings?
I thought when you use $cache->read it automatically returns as an array, even if empty.

Use this:
function socialgroups_browse()
{
    global $mybb, $cache, $table, $lang;
    if($mybb->input['page'])
    {
        $currentpage = intval($mybb->input['page']);
    }
    else
    {
        $currentpage = 1;
    }
    if($currentpage <= 0)
    {
        $currentpage = 1;
    }
    $socialgroups = $cache->read("socialgroups");
    $start = $currentpage * 50 - 50;
    $pages = ceil(count($socialgroups) / 50);
    if($currentpage > $pages)
    {
        $currentpage = $pages;
    }
    $records = count($socialgroups);
    $url = "index.php?module=user-social_groups&action=browse";
    $admin_pagination = draw_admin_pagination(intval($currentpage), 50, $records, $url);
    echo $admin_pagination;
    if(is_array($socialgroups))
    {
        $socialgroups = array_slice($socialgroups, $start, 50);
        $table->construct_header("Name");
        $table->construct_header("Leader");
        $table->construct_header("Discussions");
        $table->construct_header("Members");
        $table->construct_header("Edit");
        $table->construct_row();
        foreach($socialgroups as $socialgroup)
        {
        $table->construct_cell($socialgroup['name']);
        $table->construct_cell($socialgroup['leader']);
        $table->construct_cell($socialgroup['numdisc']);
        $table->construct_cell(count(explode(",", $socialgroup['memberids'])));
        $table->construct_cell("<a href=\"index.php?module=user-social_groups&action=manage_group&action2=edit_group&gid=" . $socialgroup['sgid'] . "\">Edit</a>");
        $table->construct_row();
    }
        $table->output("Social Groups");
    }
}
An aesthetic issue for groups.php:
  • Update row span for the category bar. Currently has 4 instead of 5 (or mismatched columns?).
  • Add a column header for the group listing page. Currently has Name, Group Leader, Group Discussions, Description, no column header (granted it's not just a result of mismatched columns)
  • The description of the group is being squeezed out of it's column. The description column for the group has the thread count in it instead of the group's description. Currently lists Name, Nothing, Group Leader, Thread Count, Description.
If you know Github, you can create a pull request for it. Otherwise I'll deal with it when I have time.
Thank you for the update!

The 500 internal error was me being stupid and uploading the admin folder (I've renamed my admin directory), rather than putting the files in my admin directory.

Thanks for the update!
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15