[3.3][BETA] Anonymous Posts

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
Toxyy
Registered User
Posts: 938
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek
Contact:

[3.3][BETA] Anonymous Posts

Post by Toxyy »

Extension Name: Anonymous Posts
Author: toxyy
Extension Description: Post anonymously in phpbb 3.3
Extension Version: 0.11.1
    Requirements:
    • phpBB 3.3.5-RC1
    • PHP 7+
    If you were using the latest version of this extension before this update (version 0.10.0), you will have to run this query on your database to upgrade:

    Code: Select all

    INSERT INTO `phpbb_config` (`config_name`, `config_value`, `is_dynamic`) VALUES ('anonymous_posts_version', '0.100', '0')
    Replace phpbb_config with your db prefix.

    Legacy requirements for pre 0.11.1:
    • custom event in functions_posting.php (ticket 15819) merged into 3.2.4-RC1
    • pr to fix how postrow.contact pm link is retrieved (ticket 15841) merged into 3.2.4-RC1
    • pr to be able to hide most active forum/topic in user profile (ticket 15872) merged into 3.2.5-RC1
    • pr to fix attachment permissions for anon posts (ticket 15879) merged into 3.2.5-RC1
    • pr to remove anon posts from most active forum/topic count in user profile (ticket 15880) marked for 3.2.7 or 8, not merged at this time it appears to no longer be required, will keep an eye on it
    • pr to add seven events to fix forum and topic data in the db after mod actions (ticket 15925) merged into 3.3.5-RC1
    • pr to update the event made in ticket 15879 (ticket 15943) transferred to extension code
    • pr to an event to change the bbcode quote attributes in posts being quoted (ticket 15944) merged into 3.2.6-RC1
    Extension Download: https://github.com/toxyy/anonymousposts ... 0.11.1.zip
    Github repository: https://github.com/toxyy/anonymousposts
    Languages: en, tr, sl (sl only available on master branch of github for now)
    Templates: all
    Features:
    • User, group, and forum permissions
    • Staff can see all info, plus a message saying the post is anonymous
    • Unique anonymous names per poster in the topic
    • Support for Normal and Special Ranks extension by kasimi/posey
    • Support for Recent Topics extension by PayBas/Sajaki
    Installation/notes:
    As far as I can tell, the bugs have been worked out. Version 0.11.1 should have fixed the remaining bugs, though this remains untested in a live environment versus other editions. Please report any bugs you encounter.

    How to set up this extension: viewtopic.php?p=15816151#p15816151

    Screenshots:
    User/group, and forum permissions -
    Image
    ----------------------------------------------------------------------------------------------------
    Image


    Normal users vs staff view -
    Image
    ----------------------------------------------------------------------------------------------------
    Image


    Checkbox option on posting page, enabled/disabled with permissions -
    Image


    Topic review is the same as viewtopic for staff and normal members -
    Image
    ----------------------------------------------------------------------------------------------------
    Image


    Topicrow reflects anonymous OP and last post:
    Image


    Notifications reflect unique anonymous poster:
    Image


    Quotes reflect unique anonymous poster:
    Image
    Last edited by Toxyy on Thu Oct 26, 2023 1:01 am, edited 88 times in total.
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    Toxyy
    Registered User
    Posts: 938
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek
    Contact:

    Re: [3.2][DEV] Anonymous Posts

    Post by Toxyy »

    How to set up permissions and enable this feature: viewtopic.php?p=15816151#p15816151
    Last edited by Toxyy on Fri Feb 18, 2022 10:05 pm, edited 3 times in total.
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    pikachuturkey
    Registered User
    Posts: 335
    Joined: Wed Dec 20, 2006 10:34 pm
    Location: Türkiye(Turkey)
    Name: Rıza

    Re: [3.2][DEV] Anonymous Posts

    Post by pikachuturkey »

    Turkish (tr) Language files for Anonymous Posts Version 0.1.0
    But i didn't understand why we altered "Similar Topics" setting
    "'ANP_LOG_MSG' => '<strong>Altered Similar Topics settings</strong>',"

    Common.php

    Code: Select all

    <?php
    
    /**
    * phpBB Extension - toxyy Anonymous Posts
    * @copyright (c) 2018 toxyy <[email protected]>
    * @license GNU General Public License, version 2 (GPL-2.0)
    * 
    */
    
    if (!defined('IN_PHPBB'))
    {
    	exit;
    }
    
    if (empty($lang) || !is_array($lang))
    {
    	$lang = [];
    }
    
    $lang = array_merge($lang, [
    	'ANP_MESSAGE'	=> 'Anonim gönderi',
    	'ANP_ACTION'	=> 'Anonim olarak gönder',
    ]);

    info_acp_anonymous_posts.php

    Code: Select all

    <?php
    /**
    *
    * phpBB Extension - toxyy Anonymous Posts
    * @copyright (c) 2018 toxyy <[email protected]>
    * @license GNU General Public License, version 2 (GPL-2.0)
    *
    */
    
    /**
    * DO NOT CHANGE
    */
    if (!defined('IN_PHPBB'))
    {
    	exit;
    }
    
    if (empty($lang) || !is_array($lang))
    {
    	$lang = array();
    }
    
    // DEVELOPERS PLEASE NOTE
    //
    // All language files should use UTF-8 as their encoding and the files must not contain a BOM.
    //
    // Placeholders can now contain order information, e.g. instead of
    // 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
    // translators to re-order the output of data while ensuring it remains correct
    //
    // You do not need this where single placeholders are used, e.g. 'Message %d' is fine
    // equally where a string contains only two placeholders which are used to wrap text
    // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
    //
    // Some characters you may want to copy&paste:
    // ’ » “ ” …
    //
    
    $lang = array_merge($lang, array(
    	'ANP_TITLE_ACP'		=> 'Anonim Gönderiler',
    	'ANP_SETTINGS'		=> 'Anonim Gönderi ayarları',
    	'ANP_LOG_MSG'		=> '<strong>Benzer Konular ayarları değiştirildi</strong>',
            'ANP_PERMISSIONS'       => 'Anonim gönderim yapabilir',
    ));
    User avatar
    Toxyy
    Registered User
    Posts: 938
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek
    Contact:

    Re: [3.2][DEV] Anonymous Posts

    Post by Toxyy »

    pikachuturkey wrote: Sat Sep 29, 2018 7:39 pm But i didn't understand why we altered "Similar Topics" setting
    Because I used that and another extension's files as a skeleton for another extension I was working on, which I used to make this one. Some things got missed it seems, lol. Also, it's still in dev, evidenced by how I handled the template in the installation instructions..
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    Kailey
    Community Team Leader
    Community Team Leader
    Posts: 3726
    Joined: Mon Sep 01, 2014 1:00 am
    Location: sudo rm -rf /
    Name: Kailey Snay
    Contact:

    Re: [3.2][DEV] Anonymous Posts

    Post by Kailey »

    Toxyy wrote: Sat Sep 29, 2018 5:57 am Installation/notes: Due to the limitations of events, and the nature of this extension, I cannot simply set a div to display: none and call it a day, information needs to be deleted. The quickest way to do that is to throw an {% if %} around what I don't like, as I haven't found another alternative, except figuring out how to access all the template variables in the block I need to cancel out and nulling them.

    [snip]

    So if you want to test this extension (it's in dev), do this:
    1) Open your viewtopic_body.html
    2) Find <!-- EVENT viewtopic_body_postrow_custom_fields_before -->
    3) Add

    Code: Select all

    {% if !F_ANONPOST && !postrow.IS_ANONYMOUS || (postrow.IS_ANONYMOUS &&  marttiphpbb_grouptempvars.4) || (postrow.IS_ANONYMOUS &&  marttiphpbb_grouptempvars.5) %}
    on the line before it

    4) Find <!-- EVENT viewtopic_body_contact_fields_after -->
    5) Add

    Code: Select all

    {% endif %}
    on the line after it
    You could use jxtools to insert your template code. There's an example here. The whole topic, however, is well worth a read.
    Kailey Snay - Community Team Leader
    Knowledge Base | Documentation | Community rules

    If you have any questions about the rules/customs of this website, feel free to send me a PM.
    User avatar
    Toxyy
    Registered User
    Posts: 938
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek
    Contact:

    Re: [3.2][DEV] Anonymous Posts

    Post by Toxyy »

    kinerity wrote: Sat Sep 29, 2018 10:22 pm You could use jxtools to insert your template code. There's an example here. The whole topic, however, is well worth a read.
    I saw something about that but I didn't look into it. I'm not familiar with jxtools. Will it still work as intended if javascript is disabled? I don't want user's information being leaked simply because of that. If it can't, then I wouldn't really feel it's a complete solution.
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    Kailey
    Community Team Leader
    Community Team Leader
    Posts: 3726
    Joined: Mon Sep 01, 2014 1:00 am
    Location: sudo rm -rf /
    Name: Kailey Snay
    Contact:

    Re: [3.2][DEV] Anonymous Posts

    Post by Kailey »

    Toxyy wrote: Sat Sep 29, 2018 10:24 pm Will it still work as intended if javascript is disabled? I don't want user's information being leaked simply because of that.
    I haven't looked at it from that angle. I do know Javier put out some quality code, however it may be best to read it over if you understand it. It's been used in at least one extension that I know of.
    Kailey Snay - Community Team Leader
    Knowledge Base | Documentation | Community rules

    If you have any questions about the rules/customs of this website, feel free to send me a PM.
    User avatar
    Toxyy
    Registered User
    Posts: 938
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek
    Contact:

    Re: [3.2][DEV] Anonymous Posts

    Post by Toxyy »

    kinerity wrote: Sat Sep 29, 2018 10:29 pm I haven't looked at it from that angle. I do know Javier put out some quality code, however it may be best to read it over if you understand it. It's been used in at least one extension that I know of.
    Just tested it out. It works great, but not with javascript disabled. So unfortunately I'm going to have to find another solution in this case. Thanks for getting me to try it though.
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    Toxyy
    Registered User
    Posts: 938
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek
    Contact:

    Re: [3.2][DEV] Anonymous Posts

    Post by Toxyy »

    Updated to version 0.2.0, OP updated with additional pictures.

    Quotes, viewforum topicrow, and notifications now supported. Code reorganized. Helper class made. Removed bad config from migration. Removed old language entry.

    Uses custom event made in functions_posting.php lines (my version) 2285 - 2296, I will make the pull request later.
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    Kailey
    Community Team Leader
    Community Team Leader
    Posts: 3726
    Joined: Mon Sep 01, 2014 1:00 am
    Location: sudo rm -rf /
    Name: Kailey Snay
    Contact:

    Re: [3.2][DEV] Anonymous Posts

    Post by Kailey »

    Not a huge deal, but per the Coding Guidelines you are missing new lines at the end of your files.
    Newline at end of file
    All files should end in a newline so the last line does not appear as modified in diffs, when a line is appended to the file.
    newline.png
    newline.png (661 Bytes) Viewed 12317 times
    Kailey Snay - Community Team Leader
    Knowledge Base | Documentation | Community rules

    If you have any questions about the rules/customs of this website, feel free to send me a PM.
    User avatar
    pikachuturkey
    Registered User
    Posts: 335
    Joined: Wed Dec 20, 2006 10:34 pm
    Location: Türkiye(Turkey)
    Name: Rıza

    Re: [3.2][DEV] Anonymous Posts

    Post by pikachuturkey »

    Download link is for version 0.1.0 :D


    Turkish language files for 0.2.0

    tr/anp_install.php

    Code: Select all

    <?php
    /**
    * 
    * phpBB Extension - toxyy Anonymous Posts
    * @copyright (c) 2018 toxyy <[email protected]>
    * @license GNU General Public License, version 2 (GPL-2.0)
    * 
    */
    if (!defined('IN_PHPBB'))
    {
    	exit;
    }
    if (empty($lang) || !is_array($lang))
    {
    	$lang = [];
    }
    $lang = array_merge($lang, [
    	'ANP_INSTALL_ERROR'	=> 'martti\'nin Group Template Variables eklentisi gerekli.',
    ]);
    // TRANSLATORS CAN IGNORE THIS.
    // Overwrite core error message keys with a more specific message.
    $lang = array_merge($lang, [
    	'EXTENSION_NOT_ENABLEABLE'		=> isset($lang['EXTENSION_NOT_ENABLEABLE']) ?
    		$lang['EXTENSION_NOT_ENABLEABLE'] . '<br /><br />' . sprintf($lang['ANP_INSTALL_ERROR']) :
    		null,
    	'CLI_EXTENSION_ENABLE_FAILURE'	=> isset($lang['CLI_EXTENSION_ENABLE_FAILURE']) ?
    		$lang['CLI_EXTENSION_ENABLE_FAILURE'] . '. ' . sprintf($lang['ANP_INSTALL_ERROR']) :
    		null,
    ]);

    tr/common

    Code: Select all

    <?php
    /**
    * 
    * phpBB Extension - toxyy Anonymous Posts
    * @copyright (c) 2018 toxyy <[email protected]>
    * @license GNU General Public License, version 2 (GPL-2.0)
    * 
    */
    if (!defined('IN_PHPBB'))
    {
    	exit;
    }
    if (empty($lang) || !is_array($lang))
    {
    	$lang = [];
    }
    $lang = array_merge($lang, [
    	'ANP_MESSAGE'       => 'Anonim Gönderi',
    	'ANP_ACTION'        => 'Anonim olarak Gönder',
            'ANP_PERMISSIONS'   => 'Anonim olarak gönderebilir',
    ]);
    User avatar
    Toxyy
    Registered User
    Posts: 938
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek
    Contact:

    Re: [3.2][DEV] Anonymous Posts

    Post by Toxyy »

    Major update 0.3.0

    -language support added in the listener
    -turkish added (I made another variable, please confirm that it's the right translation)
    -viewforum forumrow support added
    -search (including active topics) support added, for topicrow and postrow searches
    -fixed a bug where editing anonymous posts made them disappear
    -other minor fixes and code organization

    known bugs:
    -users dont receive notifications if your their is anonymous, such as someone quoting their anonymous post
    -anonymous usernames clickable in some areas (search, quotes). kind of ugly, considering the concept
    kinerity wrote: Tue Oct 02, 2018 12:28 pm
    Newline at end of file
    All files should end in a newline so the last line does not appear as modified in diffs, when a line is appended to the file.
    This has also been fixed.
    pikachuturkey wrote: Tue Oct 02, 2018 6:12 pm Download link is for version 0.1.0 :D
    Thanks, link updated.

    I added a new variable, I don't know turkish but it doesn't seem like you were declining any of them, so let me know if I'm right.
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    pikachuturkey
    Registered User
    Posts: 335
    Joined: Wed Dec 20, 2006 10:34 pm
    Location: Türkiye(Turkey)
    Name: Rıza

    Re: [3.2][DEV] Anonymous Posts

    Post by pikachuturkey »

    I added a new variable, I don't know turkish but it doesn't seem like you were declining any of them, so let me know if I'm right.
    yes, you are right. 8-)
    User avatar
    Toxyy
    Registered User
    Posts: 938
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek
    Contact:

    Re: [3.2][ALPHA] Anonymous Posts

    Post by Toxyy »

    Glad to hear it.

    Minor update 0.3.5

    -fixed poster_id equaling 0 when editing topics, causing an sql error when trying to access it
    -fixed version check not working in acp
    -dev --> alpha

    known bugs:
    -users dont receive notifications if your their is anonymous, such as someone quoting their anonymous post
    -anonymous usernames clickable in some areas (search, quotes). kind of ugly, considering the concept
    -checkbox doesn't stay checked, doesn't inherit property when editing
    -possible mystery sql error, should be fixed though
    -"Anonymous 0" in last post in search topicrow

    I feel this is now somewhat usable. Will upgrade to beta or further once the template workaround is taken care of.

    EDIT:

    Minor update 0.3.7

    -checkbox stays checked if post is anonymous
    -finally fixes poster_id not being put into db when editing, 4 editing postmodes huh
    -mystery sql error likely doesn't exist
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    Toxyy
    Registered User
    Posts: 938
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek
    Contact:

    Re: [3.2][BETA] Anonymous Posts

    Post by Toxyy »

    Major update 0.5.0 (0.4.0 skipped)

    0.4.0 notes:
    -notification fix is in dev
    -anonymous profile link no longer clickable in quotes
    -no longer clickable in the search postrow where it says "by {author}"
    -white space removed
    -some reorganization

    0.5.0 notes:
    -Alpha --> Beta
    -notifications work, if youve posted anonymously youll get them for quotes and stuff. should work properly in most cases. is_anonymous_list index matching is questionable in edge cases
    -no more template editing!!! contact information removed without needing to modify the template as in OP
    -some cleanup

    OP has been updated and the template hack removed as it is no longer necessary. A PR has been made to accommodate as well. All styles should be supported now, as far as I know.

    I'd say this is a lot more usable than the alpha was and is more versatile per style you have installed, so I've changed this to beta.

    Todo:
    -some approving post bug
    -recheck everything
    -optimize queries, especially how get_poster_index is used...

    -caching???

    EDIT: minor update 0.5.1
    -support added for the Normal and Special Ranks extension, removes those ranks properly now

    EDIT EDIT:

    major update 0.6.1 - optimization time (much safer to use now)
    -if running previous versions, this will populate your new mysql db posts table column automatically
    -optimization!!! much safer to use now
    --language for anonymous called as little as possible
    --same for is_staff function
    --anonymous index is now a column in the posts table, so this variable is moved into existing sql queries now
    -removed useless event
    -potentially useless other event commented out but not disabled
    -friend and foe status no longer influences anonymous posts
    -new edit bug fixed
    -(native search only) no longer able to search by author and see their anonymous posts
    --helper function made and ready to test the other 2 (sphinx has no event that i need, and who uses it anyways?)
    -(cant remember if i logged this or not), but box no longer stays checked if quoting an anonymous post
    -useless migration files removed for future people
    -migration files fixed (thank you david63)
    -since everything got optimized, minor fixes is an understatement. thanks xdebug and qcachegrind!
    -two tiny other bugs fixed after everything got jumbled around

    update 0.7.0
    -notifications support language files now
    -edit was changing anonymous index in weird circumstances
    -minor bug fixes here and there
    -mysql and postgres SHOULD be supported for author search exclusion but they are untested
    -martti's group extension isn't required anymore (sorry!)
    --anp_install.php removed from tr and en because of that

    update 0.7.5
    -recent topics extension support added
    -editing posts no longer messes with index....again
    -made two global variables for easier access

    todo:
    -approved posts bug
    -anything else that pops up

    major update 0.8.0
    -code overhaul
    --generic functions made to standardize everything, makes it easier to add/remove features in the future
    --code cleaned up. only thing left to contemplate is the use of queries, caching, and if i can get the info i need in other queries instead of my own
    --php 7.2 compatible
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    Post Reply

    Return to “Extensions in Development”