block users

I'm on elgg 2.31 and I just tried out the Block_users_master plugin from github.  If I block someone it says fatal error.  I'm wondering if anyone else had encountered this and figured it out.  Thanks  Robb

  • Hi Robb, please share the error log for the error.

  • Argument 2 passed to MFP\BlockUsers\is_blocked() must be an instance of ElggUser, instance of ElggSite given, called in /home/feedbaec/public_html/social/mod/block_users/start.php on line 183

    Log at time 1550107827 may have more data.

    TypeError Object
    (
    [message:protected] => Argument 2 passed to MFP\BlockUsers\is_blocked() must be an instance of ElggUser, instance of ElggSite given, called in /home/feedbaec/public_html/social/mod/block_users/start.php on line 183
    [string:Error:private] => TypeError: Argument 2 passed to MFP\BlockUsers\is_blocked() must be an instance of ElggUser, instance of ElggSite given, called in /home/feedbaec/public_html/social/mod/block_users/start.php on line 183 and defined in /home/feedbaec/public_html/social/mod/block_users/lib/functions.php:49
    Stack trace:
    #0 /home/feedbaec/public_html/social/mod/block_users/start.php(183): MFP\BlockUsers\is_blocked(Object(ElggUser), Object(ElggSite))
    #1 [internal function]: MFP\BlockUsers\check_page_owner('pagesetup', 'system', NULL)
    #2 /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/EventsService.php(113): call_user_func_array('MFP\\BlockUsers\\...', Array)
    #3 /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/lib/views.php(1979): Elgg\EventsService->trigger('pagesetup', 'system')
    #4 [internal function]: _elgg_manage_pagesetup('view_vars', 'page/elements/t...', Array, Array)
    #5 /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/PluginHooksService.php(52): call_user_func_array('_elgg_manage_pa...', Array)
    #6 /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/ViewsService.php(292): Elgg\PluginHooksService->trigger('view_vars', 'page/elements/t...', Array, Array)
    #7 /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/lib/views.php(337): Elgg\ViewsService->renderView('page/elements/t...', Array, false, 'default')
    #8 /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/lib/views.php(1163): elgg_view('page/elements/t...', Array)
    #9 /home/feedbaec/public_html/social/mod/block_users/pages/block_users/blocked_user_content.php(10): elgg_view_title('You are trying ...')
    #10 /home/feedbaec/public_html/social/mod/block_users/start.php(75): include('/home/feedbaec/...')
    #11 [internal function]: MFP\BlockUsers\page_handler(Array, 'block_users')
    #12 /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/Router.php(100): call_user_func('MFP\\BlockUsers\\...', Array, 'block_users')
    #13 /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/Application.php(436): Elgg\Router->route(Object(Elgg\Http\Request))
    #14 /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/Application.php(384): Elgg\Application->run()
    #15 /home/feedbaec/public_html/social/index.php(8): Elgg\Application::index()
    #16 {main}
    [code:protected] => 0
    [file:protected] => /home/feedbaec/public_html/social/mod/block_users/lib/functions.php
    [line:protected] => 49
    [trace:Error:private] => Array
    (
    [0] => Array
    (
    [file] => /home/feedbaec/public_html/social/mod/block_users/start.php
    [line] => 183
    [function] => MFP\BlockUsers\is_blocked
    [args] => Array
    (
    [0] => ElggUser Object
    (
    [url_override:protected] => 
    [temp_metadata:protected] => Array
    (
    )

    [temp_annotations:protected] => Array
    (
    )

    [temp_private_settings:protected] => Array
    (
    )

    [volatile:protected] => Array
    (
    )

    [orig_attributes:protected] => Array
    (
    )

    [attributes:protected] => Array
    (
    [guid] => 36
    [type] => user
    [subtype] => 0
    [owner_guid] => 0
    [site_guid] => 1
    [container_guid] => 0
    [access_id] => 2
    [time_created] => 1549525866
    [time_updated] => 1549525866
    [last_action] => 1550107826
    [enabled] => yes
    [name] => Administrator
    [username] => admin
    [password] => 
    [salt] => 
    [password_hash] => $2y$10$mv76RphhDphbGozqYji9e.n5QUDkIeaoHhmyl0dUFc7KYqTRLC4a6
    [email] => admin@feedbae.com
    [language] => en
    [banned] => no
    [admin] => yes
    [prev_last_action] => 1550107823
    [last_login] => 1550099091
    [prev_last_login] => 1550065334
    )

    [valid:protected] => 
    [time:ElggData:private] => 
    )

    [1] => ElggSite Object
    (
    [url_override:protected] => 
    [temp_metadata:protected] => Array
    (
    )

    [temp_annotations:protected] => Array
    (
    )

    [temp_private_settings:protected] => Array
    (
    )

    [volatile:protected] => Array
    (
    )

    [orig_attributes:protected] => Array
    (
    )

    [attributes:protected] => Array
    (
    [guid] => 1
    [type] => site
    [subtype] => 0
    [owner_guid] => 0
    [site_guid] => 1
    [container_guid] => 0
    [access_id] => 2
    [time_created] => 1549525866
    [time_updated] => 1549887716
    [last_action] => 1549979269
    [enabled] => yes
    [name] => FeedBae.com
    [description] => Social site for size acceptance
    [url] => http://feedbae.com/social/
    )

    [valid:protected] => 
    [time:ElggData:private] => 
    )

    )

    )

    [1] => Array
    (
    [function] => MFP\BlockUsers\check_page_owner
    [args] => Array
    (
    [0] => pagesetup
    [1] => system
    [2] => 
    )

    )

    [2] => Array
    (
    [file] => /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/EventsService.php
    [line] => 113
    [function] => call_user_func_array
    [args] => Array
    (
    [0] => MFP\BlockUsers\check_page_owner
    [1] => Array
    (
    [0] => pagesetup
    [1] => system
    [2] => 
    )

    )

    )

    [3] => Array
    (
    [file] => /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/lib/views.php
    [line] => 1979
    [function] => trigger
    [class] => Elgg\EventsService
    [type] => ->
    [args] => Array
    (
    [0] => pagesetup
    [1] => system
    )

    )

    [4] => Array
    (
    [function] => _elgg_manage_pagesetup
    [args] => Array
    (
    [0] => view_vars
    [1] => page/elements/title
    [2] => Array
    (
    [title] => You are trying to view content from or perform an action on a user that you have blocked. To see this user's content, you must first unblock the user.
    )

    [3] => Array
    (
    [view] => page/elements/title
    [vars] => Array
    (
    [title] => You are trying to view content from or perform an action on a user that you have blocked. To see this user's content, you must first unblock the user.
    )

    [viewtype] => default
    )

    )

    )

    [5] => Array
    (
    [file] => /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/PluginHooksService.php
    [line] => 52
    [function] => call_user_func_array
    [args] => Array
    (
    [0] => _elgg_manage_pagesetup
    [1] => Array
    (
    [0] => view_vars
    [1] => page/elements/title
    [2] => Array
    (
    [title] => You are trying to view content from or perform an action on a user that you have blocked. To see this user's content, you must first unblock the user.
    )

    [3] => Array
    (
    [view] => page/elements/title
    [vars] => Array
    (
    [title] => You are trying to view content from or perform an action on a user that you have blocked. To see this user's content, you must first unblock the user.
    )

    [viewtype] => default
    )

    )

    )

    )

    [6] => Array
    (
    [file] => /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/ViewsService.php
    [line] => 292
    [function] => trigger
    [class] => Elgg\PluginHooksService
    [type] => ->
    [args] => Array
    (
    [0] => view_vars
    [1] => page/elements/title
    [2] => Array
    (
    [view] => page/elements/title
    [vars] => Array
    (
    [title] => You are trying to view content from or perform an action on a user that you have blocked. To see this user's content, you must first unblock the user.
    )

    [viewtype] => default
    )

    [3] => Array
    (
    [title] => You are trying to view content from or perform an action on a user that you have blocked. To see this user's content, you must first unblock the user.
    )

    )

    )

    [7] => Array
    (
    [file] => /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/lib/views.php
    [line] => 337
    [function] => renderView
    [class] => Elgg\ViewsService
    [type] => ->
    [args] => Array
    (
    [0] => page/elements/title
    [1] => Array
    (
    [title] => You are trying to view content from or perform an action on a user that you have blocked. To see this user's content, you must first unblock the user.
    )

    [2] => 
    [3] => default
    )

    )

    [8] => Array
    (
    [file] => /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/lib/views.php
    [line] => 1163
    [function] => elgg_view
    [args] => Array
    (
    [0] => page/elements/title
    [1] => Array
    (
    [title] => You are trying to view content from or perform an action on a user that you have blocked. To see this user's content, you must first unblock the user.
    )

    )

    )

    [9] => Array
    (
    [file] => /home/feedbaec/public_html/social/mod/block_users/pages/block_users/blocked_user_content.php
    [line] => 10
    [function] => elgg_view_title
    [args] => Array
    (
    [0] => You are trying to view content from or perform an action on a user that you have blocked. To see this user's content, you must first unblock the user.
    )

    )

    [10] => Array
    (
    [file] => /home/feedbaec/public_html/social/mod/block_users/start.php
    [line] => 75
    [args] => Array
    (
    [0] => /home/feedbaec/public_html/social/mod/block_users/pages/block_users/blocked_user_content.php
    )

    [function] => include
    )

    [11] => Array
    (
    [function] => MFP\BlockUsers\page_handler
    [args] => Array
    (
    [0] => Array
    (
    [0] => blocked_user_content
    )

    [1] => block_users
    )

    )

    [12] => Array
    (
    [file] => /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/Router.php
    [line] => 100
    [function] => call_user_func
    [args] => Array
    (
    [0] => MFP\BlockUsers\page_handler
    [1] => Array
    (
    [0] => blocked_user_content
    )

    [2] => block_users
    )

    )

    [13] => Array
    (
    [file] => /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/Application.php
    [line] => 436
    [function] => route
    [class] => Elgg\Router
    [type] => ->
    [args] => Array
    (
    [0] => Elgg\Http\Request Object
    (
    [attributes] => Symfony\Component\HttpFoundation\ParameterBag Object
    (
    [parameters:protected] => Array
    (
    )

    )

    [request] => Symfony\Component\HttpFoundation\ParameterBag Object
    (
    [parameters:protected] => Array
    (
    )

    )

    [query] => Symfony\Component\HttpFoundation\ParameterBag Object
    (
    [parameters:protected] => Array
    (
    [__elgg_uri] => /block_users/blocked_user_content
    [blocked_username] => rube2112
    [next] => http://feedbae.com/social/profile/rube2112
    )

    )

    [server] => Symfony\Component\HttpFoundation\ServerBag Object
    (
    [parameters:protected] => Array
    (
    [CONTEXT_DOCUMENT_ROOT] => /home/feedbaec/public_html
    [CONTEXT_PREFIX] => 
    [DOCUMENT_ROOT] => /home/feedbaec/public_html
    [GATEWAY_INTERFACE] => CGI/1.1
    [GEOIP_ADDR] => 166.137.102.95
    [GEOIP_AREA_CODE] => 463
    [GEOIP_CITY] => Cleveland
    [GEOIP_CONTINENT_CODE] => NA
    [GEOIP_COUNTRY_CODE] => US
    [GEOIP_COUNTRY_NAME] => United States
    [GEOIP_DMA_CODE] => 510
    [GEOIP_LATITUDE] => 41.499500
    [GEOIP_LONGITUDE] => -81.695396
    [GEOIP_METRO_CODE] => 510
    [GEOIP_POSTAL_CODE] => 44192
    [GEOIP_REGION] => OH
    [GEOIP_REGION_NAME] => Ohio
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.9
    [HTTP_CONNECTION] => keep-alive
    [HTTP_COOKIE] => phpbb3_cbl4g_k=; phpbb3_cbl4g_u=2; phpbb3_cbl4g_sid=15f886f14c18428d674554bebebb1b03; cookieconsent_status=dismiss; cp_sessionid=6285087859215119; PHPSESSID=4763cd36aa5bf7230c20a085c10b8546; feedbae.com_k=; feedbae.com_u=2; feedbae.com_sid=709572581f38701c24ea05ce1e56530f; ossn_chat_bell=off; plupload_ui_view=thumbs; Elgg=9df686b28ac28a4572a98cbbb5406fe2; __zlcmid=qqi0vRRkvhtz9t
    [HTTP_HOST] => feedbae.com
    [HTTP_REFERER] => http://feedbae.com/social/activity
    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    [HTTP_USER_AGENT] => Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.82 Safari/537.36 Vivaldi/2.3.1440.41
    [HTTP_VIA] => HTTP/1.1 akrnz04msp3ts11.wnsnet.attws.com
    [PATH] => /bin:/usr/bin
    [QUERY_STRING] => __elgg_uri=block_users/blocked_user_content&blocked_username=rube2112&next=http%3A%2F%2Ffeedbae.com%2Fsocial%2Fprofile%2Frube2112
    [REDIRECT_GEOIP_ADDR] => 166.137.102.95
    [REDIRECT_GEOIP_AREA_CODE] => 463
    [REDIRECT_GEOIP_CITY] => Cleveland
    [REDIRECT_GEOIP_CONTINENT_CODE] => NA
    [REDIRECT_GEOIP_COUNTRY_CODE] => US
    [REDIRECT_GEOIP_COUNTRY_NAME] => United States
    [REDIRECT_GEOIP_DMA_CODE] => 510
    [REDIRECT_GEOIP_LATITUDE] => 41.499500
    [REDIRECT_GEOIP_LONGITUDE] => -81.695396
    [REDIRECT_GEOIP_METRO_CODE] => 510
    [REDIRECT_GEOIP_POSTAL_CODE] => 44192
    [REDIRECT_GEOIP_REGION] => OH
    [REDIRECT_GEOIP_REGION_NAME] => Ohio
    [REDIRECT_QUERY_STRING] => __elgg_uri=block_users/blocked_user_content&blocked_username=rube2112&next=http%3A%2F%2Ffeedbae.com%2Fsocial%2Fprofile%2Frube2112
    [REDIRECT_SCRIPT_URI] => http://feedbae.com/social/block_users/blocked_user_content
    [REDIRECT_SCRIPT_URL] => /social/block_users/blocked_user_content
    [REDIRECT_STATUS] => 200
    [REDIRECT_UNIQUE_ID] => XGTEszOOuJXkUrVDCNLkVgAAAQk
    [REDIRECT_URL] => /social/block_users/blocked_user_content
    [REMOTE_ADDR] => 166.137.102.95
    [REMOTE_PORT] => 39655
    [REQUEST_METHOD] => GET
    [REQUEST_SCHEME] => http
    [REQUEST_URI] => /social/block_users/blocked_user_content?blocked_username=rube2112&next=http%3A%2F%2Ffeedbae.com%2Fsocial%2Fprofile%2Frube2112
    [SCRIPT_FILENAME] => /home/feedbaec/public_html/social/index.php
    [SCRIPT_NAME] => /social/index.php
    [SCRIPT_URI] => http://feedbae.com/social/block_users/blocked_user_content
    [SCRIPT_URL] => /social/block_users/blocked_user_content
    [SERVER_ADDR] => 184.154.13.150
    [SERVER_ADMIN] => webmaster@feedbae.com
    [SERVER_NAME] => feedbae.com
    [SERVER_PORT] => 80
    [SERVER_PROTOCOL] => HTTP/1.1
    [SERVER_SIGNATURE] => 
    [SERVER_SOFTWARE] => Apache
    [UNIQUE_ID] => XGTEszOOuJXkUrVDCNLkVgAAAQk
    [PHP_SELF] => /social/index.php
    [REQUEST_TIME_FLOAT] => 1550107827.221
    [REQUEST_TIME] => 1550107827
    )

    )

    [files] => Symfony\Component\HttpFoundation\FileBag Object
    (
    [parameters:protected] => Array
    (
    )

    )

    [cookies] => Symfony\Component\HttpFoundation\ParameterBag Object
    (
    [parameters:protected] => Array
    (
    [phpbb3_cbl4g_k] => 
    [phpbb3_cbl4g_u] => 2
    [phpbb3_cbl4g_sid] => 15f886f14c18428d674554bebebb1b03
    [cookieconsent_status] => dismiss
    [cp_sessionid] => 6285087859215119
    [PHPSESSID] => 4763cd36aa5bf7230c20a085c10b8546
    [feedbae_com_k] => 
    [feedbae_com_u] => 2
    [feedbae_com_sid] => 709572581f38701c24ea05ce1e56530f
    [ossn_chat_bell] => off
    [plupload_ui_view] => thumbs
    [Elgg] => 9df686b28ac28a4572a98cbbb5406fe2
    [__zlcmid] => qqi0vRRkvhtz9t
    )

    )

    [headers] => Symfony\Component\HttpFoundation\HeaderBag Object
    (
    [headers:protected] => Array
    (
    [accept] => Array
    (
    [0] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
    )

    [accept-encoding] => Array
    (
    [0] => gzip, deflate
    )

    [accept-language] => Array
    (
    [0] => en-US,en;q=0.9
    )

    [connection] => Array
    (
    [0] => keep-alive
    )

    [cookie] => Array
    (
    [0] => phpbb3_cbl4g_k=; phpbb3_cbl4g_u=2; phpbb3_cbl4g_sid=15f886f14c18428d674554bebebb1b03; cookieconsent_status=dismiss; cp_sessionid=6285087859215119; PHPSESSID=4763cd36aa5bf7230c20a085c10b8546; feedbae.com_k=; feedbae.com_u=2; feedbae.com_sid=709572581f38701c24ea05ce1e56530f; ossn_chat_bell=off; plupload_ui_view=thumbs; Elgg=9df686b28ac28a4572a98cbbb5406fe2; __zlcmid=qqi0vRRkvhtz9t
    )

    [host] => Array
    (
    [0] => feedbae.com
    )

    [referer] => Array
    (
    [0] => http://feedbae.com/social/activity
    )

    [upgrade-insecure-requests] => Array
    (
    [0] => 1
    )

    [user-agent] => Array
    (
    [0] => Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.82 Safari/537.36 Vivaldi/2.3.1440.41
    )

    [via] => Array
    (
    [0] => HTTP/1.1 akrnz04msp3ts11.wnsnet.attws.com
    )

    )

    [cacheControl:protected] => Array
    (
    )

    )

    [content:protected] => 
    [languages:protected] => 
    [charsets:protected] => 
    [encodings:protected] => 
    [acceptableContentTypes:protected] => 
    [pathInfo:protected] => 
    [requestUri:protected] => /social/block_users/blocked_user_content?blocked_username=rube2112&next=http%3A%2F%2Ffeedbae.com%2Fsocial%2Fprofile%2Frube2112
    [baseUrl:protected] => 
    [basePath:protected] => 
    [method:protected] => 
    [format:protected] => 
    [session:protected] => 
    [locale:protected] => 
    [defaultLocale:protected] => en
    [isForwardedValid:Symfony\Component\HttpFoundation\Request:private] => 1
    )

    )

    )

    [14] => Array
    (
    [file] => /home/feedbaec/public_html/social/vendor/elgg/elgg/engine/classes/Elgg/Application.php
    [line] => 384
    [function] => run
    [class] => Elgg\Application
    [type] => ->
    [args] => Array
    (
    )

    )

    [15] => Array
    (
    [file] => /home/feedbaec/public_html/social/index.php
    [line] => 8
    [function] => index
    [class] => Elgg\Application
    [type] => ::
    [args] => Array
    (
    )

    )

    )

    [previous:Error:private] => 
    )

  • Can you share the link from where you have downloaded the 2.x compatible block user plugin. All the plugins that I found was for elgg 1.x

  • If you are using the 1.x compatible plugin with elgg 2.x then for the above case, you can add these line in your start.php file at line 175

    if ($page_owner instanceof \ElggSite) {
     return null;
    }
  • The problem sounded familiar. Check my comments at https://elgg.org/plugins/2380396/releases/1.0.0 as these seemed to have worked to fix the issue(s) in the past.

  • The version I have is from the github page, it was mentioned in the thread about elgg 3.0 rc2 being released......someone needs to do a little better job  doicumenting this stuff.  If there's a fix, then why isn't ithe plugin updated???  I have no idea if the github version is the 1x version or not.  Why don't I know?  Because it comes with zero documentation.