Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

[#3411] using substitution in a piece of script...

  • essiele
  • essiele
  • OFFLINE
  • Posts: 61
  • Thanks: 2
  • Karma: 2
12 years 8 months ago - 12 years 8 months ago #195934 by essiele
Hi,

I'm trying to use the code for one of the twitter widgets (Profile widget) in the Field Management section of CB.

I'd like to modify the part of the code that has the twitter ID, i.e
Code:
.render().setUser('MyName').start(); </script>
to use the twitter ID (if available) of whoever is logged in... pretty much the way the tweet box works, except it shows the user's tweets. I was thinking CB Subs would be ideal for this.

Is this possible?

Ess'iele
... seeing things.
Last edit: 12 years 8 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • essiele
  • essiele
  • OFFLINE
  • Posts: 61
  • Thanks: 2
  • Karma: 2
12 years 8 months ago #195938 by essiele

essiele wrote: So, something like

Code:
.render().setUser('[twitter_userid]').start(); </script>


Ess'iele
... seeing things.

Please Log in or Create an account to join the conversation.

  • essiele
  • essiele
  • OFFLINE
  • Posts: 61
  • Thanks: 2
  • Karma: 2
12 years 8 months ago #195939 by essiele
... except it doesn't seem to work....

Ess'iele
... seeing things.

Please Log in or Create an account to join the conversation.

  • essiele
  • essiele
  • OFFLINE
  • Posts: 61
  • Thanks: 2
  • Karma: 2
12 years 8 months ago #195946 by essiele
Ok, here's a bit more info on the issue I'm currently facing.

SO I create the widget from the Twitter website and grab the code:
Code:
<script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script> <script> new TWTR.Widget({ version: 2, type: 'profile', rpp: 6, interval: 30000, width: 250, height: 300, theme: { shell: { background: '#040a70', color: '#ffffff' }, tweets: { background: '#344042', color: '#ffffff', links: '#07e3eb' } }, features: { scrollbar: true, loop: true, live: false, behavior: 'default' } }).render().setUser('MyName').start(); </script>
It's fine when I test it at the Twitter website.

Then I create a new field in Field Management:
  1. click on New Field icon
  2. select Twitter Widget as type and assign it to a tab
  3. enter the field name and title
  4. select Custom for the widget type and paste the code into the box
  5. replace "('MyName')" with "([cb:userdata field="twitter_userid" /])"
  6. save the field.

The attached image is the outcome... an empty shell.

The account being tested was logged into using Twitter credentials. I've been successful in setting up the tweet box facility provided by CB; I tweeted and it appeared (I checked on my phone). Essentially, I want the user to be able to see what s/he tweeted right there in his/her profile.

I'll keep reading, but please help me if you can. Many thanks in advance.

Ess
:unsure:


Ess'iele
... seeing things.
Attachments:

Please Log in or Create an account to join the conversation.

  • essiele
  • essiele
  • OFFLINE
  • Posts: 61
  • Thanks: 2
  • Karma: 2
12 years 8 months ago #195955 by essiele
I also tried using the Simple Raw Field Value, i.e. [twitter_userid]

No dice.

Ess

Ess'iele
... seeing things.

Please Log in or Create an account to join the conversation.

  • essiele
  • essiele
  • OFFLINE
  • Posts: 61
  • Thanks: 2
  • Karma: 2
12 years 8 months ago #195956 by essiele
Ok, after further research , it turns out that there may be a bug in the Twitter API...

DRAT!
:angry:

Ess'iele
... seeing things.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum