Advertisement:

Author Topic: [solved]"Mark as" only for logged in users in OsclassWizards Theme and other too  (Read 574 times)

BW

  • Jr. Member
  • **
  • Posts: 69
Hi, it is me again. My 2nd problem is to disable "Mark as" for non logged in users and hide it for them.

I have read two topics:

1st: http://forums.osclass.org/general-help/i-have-no-comment-field-but-receiving-comments/msg101253/

2nd: http://forums.osclass.org/bender/turn-off-'mark-as'-for-non-logged-in-users-on-bender-black/msg107291/

In a 1st topic user Dev101 has written, how to disable this function. I did what he wrote and it works. Kind of. Non logged in users still can see and mark items, but I don't receive any informations, unless they are logged in.

In a 2nd topic user MP Themes gave a solution for a Bender theme - I don't know how does it work (or not) because the code lines he pointed to replace, doesn't exist in a file item-sidebar.php of OsclassWizards theme.

What I ask you for is to help me, how am I suppose to modify, and which file, to hide "Mark as" option for non logged in users. Perhaps the 1st topic solution need only a little modification. So see this by yourself and tell me, what should I change:

oc-includes/osclass/controller/item.php

Modification by Dev101:

Code: [Select]
require_once(osc_lib_path() . 'osclass/user-agents.php');
if (osc_is_web_user_logged_in()) {
foreach($user_agents as $ua) {
if(preg_match('|'.$ua.'|', @$_SERVER['HTTP_USER_AGENT'])) {
// mark item if it's not a bot
$mItem = new ItemActions(false);
$mItem->mark($id, $as);
break;
}
}
}


Can you help me?

Regards!
« Last Edit: September 21, 2016, 06:51:41 pm by BW »

BW

  • Jr. Member
  • **
  • Posts: 69
Dev101 solved a problem:

Find a file:
/oc-content/themes/osclasswizards/item.php

Find a code:
Code: [Select]
<?php if(!osc_is_web_user_logged_in() || osc_logged_user_id()!=osc_item_user_id()) { ?>

and replace with:

Code: [Select]
<?php if(osc_is_web_user_logged_in()) { ?>

Once again, thank you dev101!