Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I get this error when adding the field: Twitter: Follow to a view. I get as many times as tweet are shown.
Notice: Undefined property: stdClass::$twitter_screen_name en twitter_views_handler_field_follow->render() (line 127 of /home/example/www/sites/all/modules/twitter/twitter_views_field_handlers.inc).
Line 127 is:
/**
* Adds Twitter Follow link.
*
* @see https://dev.twitter.com/docs/intents#follow-intent
*/
class twitter_views_handler_field_follow extends views_handler_field {
function query() {}
function render($values) {
drupal_add_js('//platform.twitter.com/widgets.js', 'external');
return '<span><a href="https://twitter.com/intent/user?screen_name=' . $values->twitter_screen_name . '">Follow</a></span>'; //LINE 127
}
}
Comment | File | Size | Author |
---|---|---|---|
#18 | twitter-n2032057-18-7.x-5.x.patch | 2.08 KB | DamienMcKenna |
Comments
Comment #0.0
chefnelone CreditAttribution: chefnelone commentedinfo
Comment #1
Rhodungeon CreditAttribution: Rhodungeon commentedSame error for me!
Comment #2
fjgarlin CreditAttribution: fjgarlin commentedSame here. Even changing the rewriting of the field it still happens. Also, in the preview screen for the view doesn't seem to show the error. Any clues?
When var_dumping the content of values on that line the result is a property called "twitter_account_screen_name" rather than "twitter_screen_name".
Comment #2.0
fjgarlin CreditAttribution: fjgarlin commentedmore
Comment #3
Verban CreditAttribution: Verban commentedComment #4
chris_slater CreditAttribution: chris_slater commenteddid this fix it for you? I applied 2032057-2.patch and it didn't clear it up.
Comment #5
tr-communication CreditAttribution: tr-communication commentedHello
Up
I have the same error ...
Anyone for more instructions ?
Thanks
Comment #6
MarcoR CreditAttribution: MarcoR commentedThe patch #3 https://drupal.org/comment/8304053#comment-8304053 fixed it for me. Thanks!
Comment #7
estoyausenteIt's seem be ok. And the patch apply perfectly.
Comment #8
preksha CreditAttribution: preksha commentedI have applied patch given in #3 but still it doesn't work. It gives me an error like:
Notice: Undefined property: stdClass::$twitter_account_screen_name in twitter_views_handler_field_follow->render() (line 128 of /var/www/example/sites/all/modules/contrib/twitter/twitter_views_field_handlers.inc).
Now it gives an error for twitter_account_screen_name..
Does any one has any idea?
Comment #9
preksha CreditAttribution: preksha commentedOk, got the solution.
The php code is as follow where I got the error:
Here if you print the $values, you will get object but in that twitter_screen_name is missing. This object will give you the properties which are included as fields in views.
So solution for this is to add "Twitter: Login name" field which relates the twitter account screen name in your views and mark it as exclude from display if you don't want to display. So that in $values object it will get the twitter account screen name property value.
This works for me.
Comment #10
Staler75 CreditAttribution: Staler75 commented#3 didn't work for me
#9 i don't understand, can you explain more? like were to make the field, did you put some extra code etc.
thanks in advance
Comment #11
womblebomble CreditAttribution: womblebomble commented@Staler...
the problem lies with this "follow" field be dependent on the existence of another field called "Login name". Once you add this the problem goes away.
So within the twitter view click "Add" within Fields section and look for the following field...
"Twitter: Login name
The screen name of the author of the tweet."
That should fix it.
P.S. remember to tick "Exclude from display" within the "Configure field: Twitter: Login name" if you don't want this field showing up.
Comment #12
Staler75 CreditAttribution: Staler75 commentedAhh okey i understand now, i was thinking to hard :)
thnx for the quick respond.
Comment #13
nicxvan CreditAttribution: nicxvan commentedIt needs to be the author field, not the user field.
Comment #14
DamienMcKennaTriggering the testbot.
Comment #16
DamienMcKennaComment #18
DamienMcKennaThis checks a few possible values for the screen name.
Comment #19
DamienMcKennaThis affects both the 7.x-5.x and 7.x-6.x branches.
Comment #20
DamienMcKennaCommitted.