Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Single function causing error, but is this function needed?

UserPost

4:58 pm
March 23, 2011


robkristie

Member

posts 3

1

Hi,

I am having a very strange problem.  We are using relevanssi for search, and with a select few search terms, it is causing a 500 error.  After much debugging, I have actually traced that error to a function in RoleScoper (weird, I know).

Anyway, the function is marked as the following t the end of role-scoper_main.php:

// equivalent to current_user_can, 

// except it supports array of reqd_caps, supports non-current user, and does not support numeric reqd_caps


Can I delete this function?  I can't seem to figure out what it does….when I do delete it, the search works perfectly.  With this function in rolescoper, it breaks my search.

From what I can tell, this has something to do with front end viewing, which we are not restricting ( we are restricting users in the back end by category).

If this function is needed, is there a reason it woudl conflict with a search?


Thanks

6:46 pm
March 23, 2011


Kevin

Admin

posts 2503

2

You can't delete the function because RS uses it quite a bit internally for capability checking.

But if you can send me a backtrace, that would probably explain what's happening and allow me to write a line of code to selectively pass through it for Relevanssi compatibility.

12:49 pm
March 24, 2011


robkristie

Member

posts 3

3

I can't get backtracing to work because it is a fatal error, and it is refusing to show

The php error log shows

PHP Fatal error:  Call to undefined function _cr_user_can() in C:\wamp\www\fresh\wp-content\plugins\role-scoper\role-scoper_main.php on line 1074

For some reason this only happens on searches with certain words, I don't understand why.

3:35 pm
March 24, 2011


Kevin

Admin

posts 2503

4

This change to role-scoper_main.php should fix it:

change:

if ( is_content_administrator_rs() )
   return current_user_can( $reqd_caps );

return _cr_user_can( $reqd_caps, $object_id, $user_id, $meta_flags );

to:

if ( is_content_administrator_rs() || ! function_exists( '_cr_user_can' ) )
   return current_user_can( $reqd_caps );

return _cr_user_can( $reqd_caps, $object_id, $user_id, $meta_flags );

About the Agapetry forum

Currently Online:

16 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1249

Posts: 5659

Members:

There are 1261 members

There are 1 guests


Kevin has made 2503 posts

Top Posters:

metal450 - 178

Ragnar - 108

YikYak - 70

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin