PDA

View Full Version : anonymous mod


Vishaaldesiking
01-22-2013, 09:36 PM
Hello,

I just made a custom mod inspired from https://vborg.vbsupport.ru/showthread.php?t=177694
but facing few minor problems with this.

$template_hook['newthread_start'] = 'Post Anonymous: <input type="checkbox" name="anonymous" value="1" tabindex="1" title="Post Anonymous">';

The Above code is for a Check box in the thread but

now the main thing:

I need to write a IF clause where i need to see

If the check box is checked then it must show ANONYMOUS (That is it should Hide the USER Details)... ELSE show the username like a regular Post.


if (anonymous == "1")
{
$template_hook['postbit'] = '<center><span class="username guest"><b>Anonymous</b></span><img src="images/anon.gif" /></center>';
}else
{
$template_hook['postbit'] = 'test';
}

This code is added in: postbit_display_start



Is there someone who can help me with complete this mod?

kh99
01-22-2013, 11:03 PM
I'm not sure, but you could try this:

global $vbulletin;
$vbulletin->input->clean_gpc('r', 'anonymous', TYPE_INT);
if ($vbulletin->GPC['anonymous'] == 1)
{
$template_hook['postbit'] = '<center><span class="username guest"><b>Anonymous</b></span><img src="images/anon.gif" /></center>';
}else
{
$template_hook['postbit'] = 'test';
}

Vishaaldesiking
01-22-2013, 11:11 PM
Let me begin by thanking you for your reply....but uinfortunately it didnt help,,

Any more ideas........??

I think it has something to do with inserting the value 1 to the data base colum where this values are saved and the function is triggered

i want a query or code which inserts a value when the USER selects the CHECK BOX before clicking SUBMIT button

kh99
01-22-2013, 11:26 PM
Oh, right. I didn't really look at the mod, I just took a guess. But I think you're right, you would need to save that value with the post, maybe by making a new column called anonymous in the post table. If you did that then you should be able to use $post['anonymous'] in your 'if'.

Edit: I haven't thought about it a lot, but maybe another approach to anonymous posting is to set the userid to 0 (like for guests or deleted users), then set the username to Anonymous. Of course if you did that, the user who wrote it wouldn't be able to edit or delete it (and I guess you'd have no record of who wrote it, so maybe it's not such a good idea).

Vishaaldesiking
01-24-2013, 10:36 AM
Oh, right. I didn't really look at the mod, I just took a guess. But I think you're right, you would need to save that value with the post, maybe by making a new column called anonymous in the post table. If you did that then you should be able to use $post['anonymous'] in your 'if'.

Edit: I haven't thought about it a lot, but maybe another approach to anonymous posting is to set the userid to 0 (like for guests or deleted users), then set the username to Anonymous. Of course if you did that, the user who wrote it wouldn't be able to edit or delete it (and I guess you'd have no record of who wrote it, so maybe it's not such a good idea).

I need a Query or a Function so that when some one clicks the Check box in the Post before posting, the Value in the Database table for a column should be changed from 0 to 1.

o indicating REGULAR post
1 Indicating ANONYMOUS post

Kindly some one help me in this regard.

--------------- Added 1359044891 at 1359044891 ---------------

thanks for all the support mine mod is done:D
and its works perfect