Helping you Build Your Own Social Network!

Faster, better and easier!

Can't access buddypress functions, vars

(2 posts) (1 voice)
  • Started 1 year ago by davewoodbridge
  • Latest reply from davewoodbridge

  1. Hey everyone (especially Brajesh)!

    I'm writing a basic link-embed plugin a-la-Facebook and I've run into a problem adding content to the activity stream.

    I've got everything working: my code takes a url, parses the images and allows the user to choose between thumbnails, edit the title and description, and then click "go". All works great.

    The problem is that I've used javascript to return form results without refreshing the page... but the content that is retrieved by the javascript onsubmit call does not have access to the BuddyPress functions.

    In other words, I submit the url using a form which is processed using a php script called by javascript/onsubmit. It displays the "preview" so the user can edit thumbs/title/description, and I submit that form, also using javascript to call a php script - so the page doesn't refresh. That final PHP script returns the final results... but when I go to call bp_activity_add(), it can't find it.

    I also declare "global $bp", but can't access any of the BP vars.

    My question is: how can I get acess to the BP functions and vars again after processing these forms using js?

    I hope this makes sense! You can view the plugin "working" at inafrica.davewoodbridge.com.

    Thanks in advance for any help,

    Dave.

    Posted 1 year ago #
  2. Actually, maybe a better question is: can I add my new activity using Javascript?

    Dave.

    Posted 1 year ago #

Reply

You must log in to post.