News:

Wondering if this will always be free?  See why free is better.

Main Menu

Anonymous Board Mod

Started by JMV290, November 04, 2007, 07:12:46 PM

Previous topic - Next topic

Huf

Quote from: JMV290 on December 21, 2011, 11:51:35 AM
Lupin, isn't your board 1.x?

Huf, is there a field "anonymous_board" in your database?  Try to manually run the install.php script and see what's happening, I'm curious as to whether or not the script is running. I haven't been able to recreate the issue so I can't test it myself.  It should be a column under {dbprefix}boards.

Alright, I checked the database and there is a column "anonymous_board" in the "smf_boards" table. The column's value for all other areas is 0 and for the anonymous area it's 1. This was the case when I posted my previous message as well, I just forgot to mention it. :-[

I backtracked the mod's installation on the Theme and Source files to see if for some reason something would have been omitted, but all the changes were there. The only thing that was different that in the install.xml was in the Post.template.php file where installation xml says this:
<file name="$themedir/Post.template.php">
<operation>
<search position="after"><![CDATA[
// Finally, the submit buttons.
]]></search>
<add><![CDATA[
// anonymous board mod
if ( $context['anonymous_board'] )
echo ' '. $txt['Post_anonymous'] .' <input type="checkbox" name="post_unanon" />';

]]></add>
</operation>
</file>

which should place the anonymous board mod changes after the "//Finally..." line but in my board's Post.template.php the anonymous board modification is before the "//Finally..." line. :o Not that it makes any difference in the end, since the "//Finally..." line is just a comment, but I still found that a bit weird. :laugh:

I just checked the error log again and the last errors of the matter have been from December 18th. I tried making a new topic in the anonymous area and now the "Post with your username" checkbox appeared and I could start a topic anonymously.

I haven't touched anything, haven't made any changes or anything and now it works. I'm the only admin that touches any files or packages as well so no-one else has done any modifications either. I'm stumped. Some mysterious things are happening. ;D

I'll be doing some testing on my forum still, but at the moment the problem seems to have been fixed. I wonder if it was some kind of a caching problem or something, my forum has had some other problems with it as well and that's the only thing I've tampered with these past couple of days. ???

In any case, I'll be reporting back if the error appears again or if I can determine what it actually was that was causing it but at the moment it seems to be working for all different usergroups without a problem so all is well.

Happy Holidays and thanks for the great mod!  :)

JMV290

Thank you very much.  I'll take a look and might have to rework the query to see what it's inserting the code there. Glad it works for you.  I should have a fix up within the next few days.

Kindred

it is inserting the code correctly.

search position = after
means
add code = before the searched position
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

samurai-lupin

Yes, I use the SMF 1.1 version of the mod. I'd greatyl appreciate any input on how I can solve this problem. Thank you.

distante

Is there some way to pass a whole forum into a "Anonymous Board" changing the current posts? (and all the way around)

I have a hidden "girl talk" sub forum for members only that I like to make public but using the anonymous feature, to see how it works (and if don't go back to be a "normal" board)

Kindred

hmmmm....

MYSITE/index.php?action=post2;start=0;board=11
8: Undefined index: anonymous_board
File: /MYSITEDIR/Themes/default/Post.template.php
Line: 746

the offending line is:
if ( $context['anonymous_board'] )
which implies that the value is never set in the context array...


Also, setting a board to anonymous (with the checkbox) works...  but I see no option at all to allow the user to NOT be anonymous. (did you remove that functionality?)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Scorpii

Exact same error here, trying to track it down..

hxxp:www.mysite.com/forum/index.php?action=post;board=86.0 [nonactive]
Undefined index: anonymous_board
File: /home/user/public_html/forum/Themes/default/Post.template.php
Line: 602

here are lines 601, 602, 603
// anonymous board mod
if ( $context['anonymous_board'] )
echo ' '. $txt['Post_anonymous'] .' <input type="checkbox" name="post_unanon" />';


The option to allow anonymous appears on replies for me as well, but not on the initial post. Would apprecialte any feedback, going to try to trace down where the variable was set.. was thinking of trying to put an isset check in but would probably just clear up the errors and not fix the issue i'm guessing..

Kindred

that is a good point... every single mod that sets a variable like this should always check to see if it's set...   of course, as you say, it removed the error but won't fix the underlying problem.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

samurai-lupin

Quote from: samurai-lupin on December 21, 2011, 10:27:52 PM
Yes, I use the SMF 1.1 version of the mod. I'd greatyl appreciate any input on how I can solve this problem. Thank you.

I wanted tpo bump this and would greatly appreciate a fix for this problem. Thank you!

shazoo!

#229
Running 2.0.2 The anonymous option does not show up on a new topic but it does on the replies.

What do I need to do to fix this?

It seems to come and go for no apparent reason


samurai-lupin

Any news on the problem running this mod on SMF 1.1?

shazoo!

Has anyone figured out how to add the check box to quick reply?

littlenicki

Fomer SMF user. Switched to Invision Power Board and VBulletin

shazoo!


MiY4Gi

No mods are dead on SMF until an admin, the acting developer, or another developer says so. A little patience wouldn't go amiss. I'm also interested in this mod. Also, when enough people start experiencing the same error, one of the users usually manages to isolate and fix the problem.
Check out my new website, MyAnimeClub.net. I plan to create the largest anime community, and most fun and user-friendly anime forum in the world. It's still in the development stage though.

shazoo!

Technically that may be true, but no one has even ventured to answer my questions since April
After 3 months, I gave up.

littlenicki

Since people have been looking for a fix for well over a year this sounds like abandoned to me. Sad but true.
Fomer SMF user. Switched to Invision Power Board and VBulletin

MiY4Gi

#237
Here's the fix for the Anonymous Board Mod (SMF 2.0) all you guys have been waiting for.

In Load.php

Find:


'cur_topic_starter' => empty($topic) ? 0 : $row['id_member_started'],


Then below the above code add:


                                'anonymous_board' => $row['anonymous_board'],


Next, find and delete:


$context['anonymous_board'] = $row['anonymous_board'];


Now find:


else
{
// Otherwise the topic is invalid, there are no moderators, etc.
$board_info = array(
'moderators' => array(),
'error' => 'exist'
);
$topic = null;
$board = 0;
}
$smcFunc['db_free_result']($request);
}


And below the above code add:



        // Is the board anonymous?   
$context['anonymous_board'] = $board_info['anonymous_board'];


This is what your final code should look like:


// Basic operating information. (globals... :/)
$board_info = array(
'id' => $board,
'moderators' => array(),
'cat' => array(
'id' => $row['id_cat'],
'name' => $row['cname']
),
'name' => $row['bname'],
'description' => $row['description'],
'num_topics' => $row['num_topics'],
'unapproved_topics' => $row['unapproved_topics'],
'unapproved_posts' => $row['unapproved_posts'],
'unapproved_user_topics' => 0,
'parent_boards' => getBoardParents($row['id_parent']),
'parent' => $row['id_parent'],
'child_level' => $row['child_level'],
'theme' => $row['id_theme'],
'override_theme' => !empty($row['override_theme']),
'profile' => $row['id_profile'],
'redirect' => $row['redirect'],
'posts_count' => empty($row['count_posts']),
'cur_topic_approved' => empty($topic) || $row['approved'],
'cur_topic_starter' => empty($topic) ? 0 : $row['id_member_started'],
                                'anonymous_board' => $row['anonymous_board'],
);

// Load the membergroups allowed, and check permissions.
$board_info['groups'] = $row['member_groups'] == '' ? array() : explode(',', $row['member_groups']);

do
{
if (!empty($row['id_moderator']))
$board_info['moderators'][$row['id_moderator']] = array(
'id' => $row['id_moderator'],
'name' => $row['real_name'],
'href' => $scripturl . '?action=profile;u=' . $row['id_moderator'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_moderator'] . '">' . $row['real_name'] . '</a>'
);
}
while ($row = $smcFunc['db_fetch_assoc']($request));

// If the board only contains unapproved posts and the user isn't an approver then they can't see any topics.
// If that is the case do an additional check to see if they have any topics waiting to be approved.
if ($board_info['num_topics'] == 0 && $modSettings['postmod_active'] && !allowedTo('approve_posts'))
{
$smcFunc['db_free_result']($request); // Free the previous result

$request = $smcFunc['db_query']('', '
SELECT COUNT(id_topic)
FROM {db_prefix}topics
WHERE id_member_started={int:id_member}
AND approved = {int:unapproved}
AND id_board = {int:board}',
array(
'id_member' => $user_info['id'],
'unapproved' => 0,
'board' => $board,
)
);

list ($board_info['unapproved_user_topics']) = $smcFunc['db_fetch_row']($request);
}

if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] >= 3))
{
// !!! SLOW?
if (!empty($topic))
cache_put_data('topic_board-' . $topic, $board_info, 120);
cache_put_data('board-' . $board, $board_info, 120);
}
}
else
{
// Otherwise the topic is invalid, there are no moderators, etc.
$board_info = array(
'moderators' => array(),
'error' => 'exist'
);
$topic = null;
$board = 0;
}
$smcFunc['db_free_result']($request);
}

        // Is the board anonymous?   
$context['anonymous_board'] = $board_info['anonymous_board'];


Now it's just up to the mod developer to incorporate the above code into the mod. If you would like to know what was causing the problem, then read this thread.
Check out my new website, MyAnimeClub.net. I plan to create the largest anime community, and most fun and user-friendly anime forum in the world. It's still in the development stage though.

shazoo!

Quote from: MiY4Gi on July 27, 2012, 08:29:31 PM
Here's the Anonymous Board Mod SMF 2.0 fix all you guys have been waiting for.

In Load.php

Find:


'cur_topic_starter' => empty($topic) ? 0 : $row['id_member_started'],


Then below the above code add:


                                'anonymous_board' => $row['anonymous_board'],


Next, find and delete:


$context['anonymous_board'] = $row['anonymous_board'];


Now find:


else
{
// Otherwise the topic is invalid, there are no moderators, etc.
$board_info = array(
'moderators' => array(),
'error' => 'exist'
);
$topic = null;
$board = 0;
}
$smcFunc['db_free_result']($request);
}


And below the above code add:



        // Is the board anonymous?   
$context['anonymous_board'] = $board_info['anonymous_board'];


This is what your final code should look like:


// Basic operating information. (globals... :/)
$board_info = array(
'id' => $board,
'moderators' => array(),
'cat' => array(
'id' => $row['id_cat'],
'name' => $row['cname']
),
'name' => $row['bname'],
'description' => $row['description'],
'num_topics' => $row['num_topics'],
'unapproved_topics' => $row['unapproved_topics'],
'unapproved_posts' => $row['unapproved_posts'],
'unapproved_user_topics' => 0,
'parent_boards' => getBoardParents($row['id_parent']),
'parent' => $row['id_parent'],
'child_level' => $row['child_level'],
'theme' => $row['id_theme'],
'override_theme' => !empty($row['override_theme']),
'profile' => $row['id_profile'],
'redirect' => $row['redirect'],
'posts_count' => empty($row['count_posts']),
'cur_topic_approved' => empty($topic) || $row['approved'],
'cur_topic_starter' => empty($topic) ? 0 : $row['id_member_started'],
                                'anonymous_board' => $row['anonymous_board'],
);

// Load the membergroups allowed, and check permissions.
$board_info['groups'] = $row['member_groups'] == '' ? array() : explode(',', $row['member_groups']);

do
{
if (!empty($row['id_moderator']))
$board_info['moderators'][$row['id_moderator']] = array(
'id' => $row['id_moderator'],
'name' => $row['real_name'],
'href' => $scripturl . '?action=profile;u=' . $row['id_moderator'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_moderator'] . '">' . $row['real_name'] . '</a>'
);
}
while ($row = $smcFunc['db_fetch_assoc']($request));

// If the board only contains unapproved posts and the user isn't an approver then they can't see any topics.
// If that is the case do an additional check to see if they have any topics waiting to be approved.
if ($board_info['num_topics'] == 0 && $modSettings['postmod_active'] && !allowedTo('approve_posts'))
{
$smcFunc['db_free_result']($request); // Free the previous result

$request = $smcFunc['db_query']('', '
SELECT COUNT(id_topic)
FROM {db_prefix}topics
WHERE id_member_started={int:id_member}
AND approved = {int:unapproved}
AND id_board = {int:board}',
array(
'id_member' => $user_info['id'],
'unapproved' => 0,
'board' => $board,
)
);

list ($board_info['unapproved_user_topics']) = $smcFunc['db_fetch_row']($request);
}

if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] >= 3))
{
// !!! SLOW?
if (!empty($topic))
cache_put_data('topic_board-' . $topic, $board_info, 120);
cache_put_data('board-' . $board, $board_info, 120);
}
}
else
{
// Otherwise the topic is invalid, there are no moderators, etc.
$board_info = array(
'moderators' => array(),
'error' => 'exist'
);
$topic = null;
$board = 0;
}
$smcFunc['db_free_result']($request);
}

        // Is the board anonymous?   
$context['anonymous_board'] = $board_info['anonymous_board'];


Now it's just up to the mod developer to incorporate the above code into the mod. If you would like to know what was causing the problem, then read this thread.
THis fixes the issue where the checkbox doesn't show on a new topic?  nice!!

Now if someone could figure out how to add it to the quick reply

Arantor

It working properly on 2.0.

Advertisement: