Topic-icon How can I make individual activity pages 4 custom open graph actions?

Support Specialist
Ooohhh.. Thanks for sending that to me. There is a SQL bug in that statement. At the very end is:
AND (`created` > (NOW() - INTERVAL MONTH) OR 1)
There should be a number after the INTERVAL word, like "- INTERVAL 5 MONTH". Without that, the query doesn't make sense and will error out.

My guess is that in your action settings, you've left that field blank. It would make sense since you set it as a one-time only action, but our query is still expecting something there (even if it's really not used).

So, try setting a number in that parameter.. anything will work, it won't matter.. and then test again. Let us know, and we can fix that in the next release. Just adding a number though should fix you up regardless though.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
YAY.... Moving again!!!

Thanks alex!!! I will let you know when I hit my next snag but that fixed the current problem.

Ryan
The topic has been locked.
Support Specialist
Ryan,
Just saw your other PM with a print out from other SQL queries you're doing. The main error line in that print out was:

[cursor:protected] => Couldn't fetch mysqli_result in /YOUR_SERVER_PATH/components/com_userprofilepoints/views/main/tmpl/default.php on line 28

.. with lots of other similar warnings/notices. Those aren't related to the JFBConnect query. The MySQL cursor is just sort of a 'log' of what MySQL has done. My guess is that those are warnings from the last SQL error.

If you edited that userprofilepoints/.../default.php file and added the print_r statement that the errors are mentioning, then removing that is likely how you'd rid yourself of those messages. Either way, I don't think they are critical though.

Let us know how everything else is going. Excited to see that page up and running live!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
Thanks Alex.... So... Both of my views are working pretty well so far! I can easily hide my "expired" coupons/objects from outputting in my custom view with the code provided above... As long as there is a number in that time period field in the backend of jfbconnect you mentioned!

So... On to my next (last) issues!
1) I am still hoping for the filtering we discussed in the opengraph activity view... To display used objects from a selected action rather than all of them in one place. (just a reminder... sure you remember... Thx!)

2) AND FINALLY... to wrap up what I am calling my "v1" I just need to find a way to do ONE LAST SET OF FILTERING... Here is what I am trying to do:

I have 2 Types of Custom Objects (Coupons & Brands) - Both each are their own k2 category
I have 2 Types of Custom Actions (Clip & Save) - Each are associated with their respective categories

Users can either:
Clip Coupons
OR
Save Brands

So far... You have helped me create a view where I can display ALL of the COUPONS that have not been CLIPPED by a user... :)

What I need now... Is to check each coupon for an extra-field value I have already setup called BRAND.... AND ONLY DISPLAY THE COUPON if it's extra-field value BRAND... Matches a BRAND OJECT that has ALSO already been SAVED by the user.

So before displaying the coupon in my view... I wish to check that it's available AND that is a coupon that corresponds to an already SAVED BRAND... Using an extra field in each coupon to compare against the names of SAVED BRANDS

Does this make sense?.... Trying to be as clear as possible.... I am not really sure the best way to do this?.... Maybe something like a preg match against an array of the users already SAVED BRANDS?

So essentially... Before I executed the logic you gave me above in this thread... I would get an array/list of all the USERS SAVED BRANDS as well???? Then only display the coupon if it's extra-field value is ALSO matching the name of a SAVED BRAND???

It's gonna be sweet when it's finished... Basically I am making a "Custom Coupon Feed" that only displays UNCLIPPED COUPONS from BRANDS the user has ALREADY SAVED.

THANKS AGAIN ALEX

:)
The topic has been locked.
Active Subscriptions:

None
Ok... After some more thought... I think I need to use k2 TAGS to do this....

What I need simply put is this:

From my view that displays all the users AVAILABLE COUPONS... I need to get an array of the users SAVED/USED BRANDS (my other object type)... and then REMOVE / FILTER out any of the COUPONS that do not have a TAG that matches the SAVED BRAND's k2 ITEM TITLE...

Hope you're well,

Ryan
The topic has been locked.
Support Specialist
Ryan,
Sorry for the delay. Takes some digesting of what you're looking for sometimes :)

Alright... I think you can do what you're looking for with tags or categories. Tags I think may be difficult though since both the coupon and the brand would have the coupon, and you'll have to filter that out.. additionally, you may accidentally 'tag' more than one brand or coupon.

What you may want to do is create a new field in your coupon category for "associated brand". Then, put the id of the K2 item's brand article in that field. (You'd need to hide that field from displaying, but that's easy with some CSS). Since the unique_key that we store for Open Graph actions on a K2 item is the actual article ID itself, it should be pretty easy to do a query on our opengraph_activity table like:
SELECT COUNT(*) FROM #__opengraph_activity WHERE user_id = <Joomla ID> AND unique_key = <K2_BRAND_ID> AND action_id = <ACTION_SAVE_ID> AND object_id = <OBJECT_BRAND_ID> AND status = '1'
If that returns a >1 value, you should know that the user has "saved" that "brand". There's a bit of hard-coding values in there for the action and object ID, but you should know those already. You could look them up dynamically, but I think that's unnecessary overhead for your application.

That will require a 1:1 query per display of a coupon, which may be a bit much. You could easily remove the unique_key statement and return just rows of brands that have been saved in an array. Then, just iterate through that. A little savings on SQL queries never hurts.

I hope that helps get you started, but if not, or I'm way too confusing, just let me know.

Best of luck, and keep me posted!
Alex
The topic has been locked.
Active Subscriptions:

None
Sorry I disappeared... I AM SO CLOSE but definitely stuck... Gonna work on it tonight... Who knows... Maybe something will "unstick"?!?!... :-/

Curious if you ever got around to adding the filter to the activity view that we originally talked about? So that I might be able to have separate activity views for each action type? :)

Hope all is well Alex!

If there were only more hours in the day............
The topic has been locked.
Support Specialist
Ryan,
Sorry for the delay. Nope, haven't added the filters yet. It's definitely in our queue of v5.1 tasks. Was hoping to get to it sooner, but, as you mention.. only so many hours.

Let me know if this becomes (or already is) critical for you. There's been a lot of changes to Open Graph stuff from Facebook and we need to update our documentation and make a few changes to our Open Graph implementation as is.. so 5.1 will hopefully bring everything back inline. Nothing should be broken now, just so you know.. just different configuration interfaces on their end 'n stuff.

Thanks,
Alex
The topic has been locked.