Hi again,

Other thing about this module. When I give the right edit own facebook_status to a role, users of this role can't edit their own status, the status box doesn't open up when i click on the status...

Comments

julienbras’s picture

little update :
When i am on a content i have created, i can change my status.
When i am on a content created by another user, i can just see the user's status
When i am on the frontpage, i see my status, but can't edit it < the issue is here for me :)

.kuma’s picture

Exact same issue here.

However, thanks for a great module!

.kuma’s picture

I was able to get what I need - users able to update their status on the front page as well as their profile page - by enabling the "update anyone's status" and using the following code to determine when to display the block:

<?php
// Show "update status" block if on front page or user's own profile page
global $user;

$showUpdateStatusBlock = false;

if ((arg(0) == 'user' && arg(1) == $user->uid && !arg(2)) || drupal_is_front_page()) {
	$showUpdateStatusBlock = true;
}

return $showUpdateStatusBlock;

?>

Without enabling the permission to "update anyone's status", users were unable to update their status anywhere. Without the above code, as julienbras mentioned, the update status block updates the creator of whichever page it's on, and anyone can edit it.

As a side note, does anyone know why this didn't work:

<?php
// Show "update status" block if on front page or user's own profile page
global $user;

$showUpdateStatusBlock = false;
if ((arg(0) == 'user' && arg(1) == $user->uid && !arg(2)) || drupal_is_front_page()) {
	return true;
else {
	return false;
	}
}

?>

Doesn't the return inside the if loop act as the return for the whole script?

icecreamyou’s picture

Assigned: Unassigned » icecreamyou

@kumakumasan, you left out a closing curly brace before the else {. But this code is more efficient:

global $user;
return (arg(0) == 'user' && arg(1) == $user->uid && !arg(2)) || drupal_is_front_page();

@julienbras:

When i am on the frontpage, i see my status, but can't edit it < the issue is here for me :)

The block will not let you edit the status if you're looking at yourdomain.com/node, but it will let you edit it if you're at yourdomain.com/. If you're having trouble with this, I advise using the Global Redirect module. (If not, I don't know what the problem is. I can't duplicate the issue, so I can't fix it unless I have more information... but unfortunately I don't know what information might lead to the answer.)

Try debugging this to see if you can find the part that's not validating. Run this code on your front page; the goal is to get the code to print "TRUE." If it prints TRUE without modification it will be the easiest situation for me to solve; if not, mess around until you get it to return TRUE and I'll see what the problem is then.

      if ( (((arg(0) == 'user' && is_numeric(arg(1)) && arg(1) == $user->uid)
        || (arg(0) == 'node' && is_numeric(arg(1)) && db_result(db_query("SELECT uid FROM {node} WHERE nid = %d", arg(1))) == $user->uid)
        || (arg(0) != 'user' && arg(0) != 'node' && !is_numeric(arg(1))))
        && user_access('edit own facebook_status')
        && !in_array($user->uid, variable_get('facebook_status_clear_user', array(0))))
        || (user_access('edit all facebook_status')
        && !in_array($fbs_uid, variable_get('facebook_status_clear_user', array(0)))) ) {
       print "TRUE";
      }

@kumakumasan:

Without enabling the permission to "update anyone's status", users were unable to update their status anywhere.

I've never experienced that behavior before and there is nothing in the code that would cause this to happen. If you think this is a valid issue, I'd appreciate if you'd open a separate issue for it and offer as much information as you can about your website: is it a multisite, is it on a subdomain, what versions of PHP, Drupal, and SQL you're using, which block(s) you're using, which permissions users have when they experience that behavior, what pages the users are on when they experience that behavior, whether you have any log errors, etc.

julienbras’s picture

Hi,

I have make some test on my website, and it seems that the $_GET['q'] variable have 'node' when i am on yourdomain.com/. So when i am on yourdomain.com/ ; i can't change my status.

I have change a little the code to that (yes, near the $_GET['q'] :) ):

      //This gigantic 'if' statement decides whether we can show the update form or not.  And if we don't show the form, we don't need the AJAX.
      if ( (((arg(0) == 'user' && is_numeric(arg(1)) && arg(1) == $user->uid)
        || (arg(0) == 'node' && is_numeric(arg(1)) && db_result(db_query("SELECT uid FROM {node} WHERE nid = %d", arg(1))) == $user->uid)
        || (arg(0) != 'user' && arg(0) != 'node' && !is_numeric(arg(1))) || ($_GET['q']=='node'))
        && user_access('edit own facebook_status')
        && !in_array($user->uid, variable_get('facebook_status_clear_user', array(0))))
        || (user_access('edit all facebook_status')
        && !in_array($fbs_uid, variable_get('facebook_status_clear_user', array(0)))) ) {

and now users can edit their status on the main page. But i don't know why their is always a 'node' in this variable ...

Thanks & Regards,

icecreamyou’s picture

Status: Active » Reviewed & tested by the community

The better way to do it is using drupal_is_front_page() - but I'll mark this as RTBC because it's a simple fix and so I'll remember to add it in. Thanks.

icecreamyou’s picture

Status: Reviewed & tested by the community » Fixed

Fixed locally, will be in CVS soon.

.kuma’s picture

IceCream,

Thanks for an amazing module! I'll double check my site and submit an issue if I can't get it fixed. One thing that comes to mind is my site uses LDAP for authentication. I haven't had time to research this issue further, but I'll follow the guidelines you mentioned in opening an issue if I still notice abnormalities when I can revisit this.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.