Deactivate Wall for users (by GUID for now) Download 1.9

German Dominik L 3 months ago

Imagine:

you have a user on your website who is not following the rules, you don't want to ban them instantly, but what are you doing now???

Correct, you use my component to block them from posting.

They can still like and read stuff, but they cannot post or comment anything.

In this first release the block is achieved by GUID.

To find out the GUID, you can use my second Component Search User by GUID

enter image description here

This alert appears, if you click on "post" or on the comment box

ChangeLog:

see "changelog.md" for every version

Version 1.9: Fixed autopagination issue, comment-boxes are now replaced with a text (translatable in locale) and button "comment" is hidden, when user is disabled

Comments
German Dominik L Replied 2 months ago

So, hopefully I got everything now

Tested with a clean installation and a non-admin user, comment-box is now completely hidden and replaced with a text, obsolete code is removed

Thank you

German Michael Zülsdorff Replied 2 months ago

the double scrollbars seem to be the result of a wrong overlay size triggered by

disableElement(commentButton);

Perhaps too simple: But why don't you just remove the elements in question instead of doing these complicate overlay size calculations /re-calculation in case of window size changes? 😅

German Michael Zülsdorff Replied 2 months ago

Okay, that obsolete code doesn't really hurt
but things are getting worse on the frontend with 1.8
Comment blocking starting at post 11 and older posts on the following pages is still not working
And aside of that your new code has a strange impact on OssnAutopagination:
As a normal user (no admin) I'm getting 2 scrollbars now on a fresh page load
and when using the scrollwheel and slowly scrolling down I'm ending with the first page like shown in the screenshot (=footer appears and pagination not triggered)


enter image description here

German Michael Zülsdorff Replied 2 months ago

1.8: Registrierung des Admin-Menüpunktes

ossn_register_menu_item('topbar_admin_dropdown', array(
   'text' => ossn_print('deactivatewall'),
   'href' => ossn_site_url('administrator/component/DeactivateWall'),
   'style' => 'text-transform: capitalize;',
                            ));

Obsolete / not necessary

because the menu entry is created automatically by ossn_register_com_panel()

see https://www.opensource-socialnetwork.org/documentation/view/6787/creating-configure-page-for-your-component-in-administrator-panel

Besides of that it does/can not work this way.
If you really need to manually register a menu item for some reason, the configuration array MUST include a line like

'name' => 'some_unique_indexname'

to make it addressable among all other entries of that menu.

German Dominik L Replied 2 months ago

@Michael, fixed with 1.7, thank you

German Michael Zülsdorff Replied 2 months ago

1.6:
BACKEND:
Is it intended we got 2 configure entries now?

enter image description here


FRONTEND:
Blocked commenting works only on first post
On second and following posts you can still click 'Comment' to get focus and cursor
Starting at post 11 and older (loaded by Autopagination) not any more limits on commenting

German Dominik L Replied 2 months ago

never mind, think I got it

German Dominik L Replied 2 months ago

I need help

In combination with FaviconsGenerator Component the Favicon is not shown on wall etc

The problem seems to be the

echo "<div id='deactivate-wall-data' style='display:none' data-user-guid='{$user_guid}' data-blocked-guids='{$blocked_guids}'></div>";

in this part:

    // Bereitstellung der Benutzer-GUID und der blockierten GUIDs durch ein verstecktes HTML-Element
if (ossn_isLoggedin()) {
    $user_guid = ossn_loggedin_user()->guid;
    $component = new OssnComponents();
    $settings = $component->getSettings('DeactivateWall');
    $blocked_guids = isset($settings->blocked_guids) ? json_encode(json_decode($settings->blocked_guids)) : '[]';

    // Füge ein unsichtbares div hinzu, das die Benutzer-GUID und blockierten GUIDs enthält
    ossn_extend_view('ossn/site/head', function() use ($user_guid, $blocked_guids) {
        echo "<div id='deactivate-wall-data' style='display:none' data-user-guid='{$user_guid}' data-blocked-guids='{$blocked_guids}'></div>";
    });
}

But I cannot find a proper solution for that

Any help?

German Dominik L Replied 2 months ago

@Michael, now I found what you meant - I corrected the code and now it seems to work - every user shows the correct GUID also with cache enabled

Thank you

German Michael Zülsdorff Replied 2 months ago

Using Google translate it gives

Ihre Komponente schlägt fehl, wenn der Ossn-Cache aktiviert ist

and that's exactly what I meant.

I doubt it's working at your site, but we may verify it this way:
Enter your cache directory and copy ossn.site.js to your local PC
Open the copied file, search for currentUserGUID and provide the result, please.

Component

Developer: Dominik
License GPL v2
Type: Site admin
Requires Ossn Version : 7.6
Latest Version: 1.9
Last Updated 2 months ago
Repository Url View Repository

Versions