Recommendations Bar: Remove read action (remove from my timeline) - api

The Recommendations Bar seems to work well, but there is not an ability to remove the most recent read action from a user's timeline. As all of the actions are handled by the plugin, there doesn't seem to be a way to get the ACTION_ID generated by the Read.
As such, Facebook will not approve my Read Action with the Recommendation Bar because I can't provide a link in the article that says "Remove from Timeline" that deletes the action from a user's timeline.

You read the /me/news.reads API call for the read action with your url as the object and then use that action id for removal.

I've had the same problem in getting my read action approved. Unfortunately, Facebook doesn't care and will reject your action on the basis that it doesn't provide the user the ability to later delete their actions.
The only way is to build this functionality in manually. The Recommendation Bar Plugin doesn't return the ID for the action after it has been posted to Facebook so you would have to manually query Facebook to get the information back:
$activity = $fb->api('/me/' . $action_id );
print_r( $activity );
You will then have to display the information correct and let the user delete their information from there.
For my site, I had to create a WordPress plugin to do just that. You can see it in action here:
http://www.xtremeps3.com/wp-admin/admin.php?page=facebook-activity/facebook-activity.php

And just as an update, the "social reading" function of the Recommendation Bar has been removed, probably due to the Read action issues (which were reported as a bug several months ago and marked as fixed at the same time as the feature disappeared). It just replicates the Recommend Box functionality now. –

Related

AtTask create/update a custom field through API on project creation created through AtTask's web app

I'm looking to use AtTask's API to update or create a custom field (ie. assign a custom ID apart from AtTask's auto-generated id) whenever a project is created through the web app. But I have not found anything about handling events in the API documentation.
I'm able to retrieve/edit project fields when issuing a request by ID or some other search parameter.
But I'm having trouble finding ways to edit project fields on some event like 'project created'.
One way I can think of is to have my script periodically search for new projects based on project metadata and edit projects that way, but there must be a better solution I probably missed.
Thanks in advance!
UPDATE:
It seems 'AtTask event subscriptions' was what I was looking for. At the time of the post below (12/2013), due to scalability issues, AtTask has turned this feature turned off with no ETA on resolving the issue. See here: Does AtTask event subscription work?
Any updates would be appreciated.
You are correct the AtTask API does not currently support events. The easiest thing to do is to just poll the system for updates using the search. You could also monitor an email address for emails that are sent upon project creation. The email will contain the project/task/issue ID that you can use to update events.

How do I halt item posting on data validation error in plugin

Let's say I have a plugin Foo in osclass. In that plugin we register a hook for when an item is posted. According to the osclass hooks documentation the only hook that is run when an item is posted is posted_item.
But as far as I can tell from looking at the code this is run after the initial item data has already been validated and stored in the database. What if a validation of some plugin specific code fails and I would like to show the user an error message and present him with the form again to give him/her the chance to alter this information? Much like if you try to submit a new item but don't fill in one of the base information like description for instance.
I can't seem to find a way to do this. Only workaround I find to avoid the item being posted despite containing invalid plugin specific data, without editing the main osclass code, is to delete the posted item again in the posted_item hook callback function of my plugin. This feels extremely cumbersome and also requires every other plugin to check that the item still exists to make sure they don't save data connected to an item that is now deleted.
What I would like, and wonder if I have missed, is a hook that is run when an item is posted but before it's written to the database and have the ability to generate "errors" that would cause the item to not be posted and the user redirected back to the form with the "error" displayed just like for the basic item information.
Anyone have a solution I have missed? This feels like a very important part of plugins and without it posted items could become very fragmented.
A user on the osclass forums (teseo) told me about the undocumented hook pre_item_add that can be used.
<?php
function cust_my_plugin($aItem) {
osc_add_flash_error_message('My plugin has a complaint.');
$pItem = new CWebItem();
$pItem->redirectTo( osc_item_post_url() );
}
osc_add_hook('pre_item_add', 'cust_my_plugin');
?>
He also sais
The only bad news is that you can't merge your plugin validation
process with that of the core script, so if the ad had an error
related to your plugin and other errors, it would be rejected twice,
one by your plugin, the second by the core script. I couldn't see any
workaround for this little issue.

Youtrack Custom field for who raised Issue?

I was expecting this to be a simple thing, but I am not quite sure how to go about doing it.
Basically on the current project we are trialling YouTrack and the agile board is great, but they could do with knowing who raised certain issues in case they need to go question them further on the issue. However I cannot seem to find a simple way to display this information.
I presumed it would be a custom field of type user, but it appears that this would manually need filling in and would not just be able to be pre-populated by the user who is making the task.
So is this possible?
Currently you can view only the assigned user's name on a ticket in Agile board.
I've created a task based on your request http://youtrack.jetbrains.com/issue/JT-19118, you are welcome to vote and leave comments.
As a rough workaround, you can configure notifications on created issues in your projects.
In this way, developers will be notified about all created issues and their reporters.
For that, create a saved search (i.e created by: {Testers}), make this search visible to needed group (by clicking "Edit" on the saved search) and enable notification "on issue created" in user's "Profile". Also, user with admin permissions is able to allow this notifications for all needed users by himself(navigate to "Administration" area -> "Users" -> {user} ->"Profile").
Note, that you can receive notifications both via email and jabber.
Thank you.

Integrating custom analytics with Shopify

I am developing an analytics product similar to Google Analytics and want to offer an integration for our Shopify users.
I would need to do just two things:
1) Insert our JavaScript snippet into the body of all the shop's pages
2) Insert a second conversion snippet into the body of only the "thank you" page after a purchase to record the sale, passing back the order total and order number
Could you point me in the right direction?
The ScriptTag endpoint looks optimal except that it doesn't seem to provide any way to differentiate between the "thank you" page and other pages, or to pass the order details from the "thank you" page into the script.
It seems like I either need an endpoint that can inject arbitrary code into all pages, or one which lets me alter the theme layout file to add code before the </body> tag.
If I can do that much, it looks like I might be able to use a conditional in the templating language to only show the conversion code if the URL matches the "thank you" page URL, and use {{ total_price }} and {{ order_number }} in that code.
Does the uninstall webhook allow me to make changes before the rights for the app are revoked? It seems like I would need a way to clean up at uninstall to remove my code from the theme, if I'm allowed to edit the layout file.
itThere are two ways you can go about this:
ScriptTags: You're already aware of this method. It's true that the script is loaded into each and every page, but you can look at document.url in your js to figure out which page you're on and conditionally execute code based on that.
Scripts inserted this way are executed during the 'onLoad' event. At that time you have access to the DOM and can do basically whatever you want with the page.
Snippets: Using the Assets endpoint you can make arbitrary changes to the user's theme. Be careful with this power! The recommended way to make complex changes to a page is to create a custom snippet in the theme with your additions and then tell the user to insert an include tag into their code where it needs to appear. This reduces clutter in the main theme files.
I'd recommend using ScriptTags wherever possible. As mentioned below, they don't need cleaning up and remove the need for user interaction when setting up the app.
--
As for the uninstall webhook: It is fired after the app has been uninstalled from the shop, so you no longer have access. It's designed to be used to trigger cleanup on your end (remove db entries, etc.). Note that ScriptTags and Webhook subscriptions are automatically cleaned up, but any changes you've made to the theme aren't
You ask a lot of questions in one posting.
For your #1 and #2 read:
http://api.shopify.com/scripttag.html
Secondly, for your app install/uninstall read:
http://api.shopify.com/webhook.html
Pay attention to the part about app/uninstalled since you're interested in that.
As for knowing when someone installs your App, that is really up to you to figure out. Should not be too hard since you probably read about how to make and App in the first place. Shopify provides lots of boiler plate code on github that can show you almost everything you asked here.

Facebook app to edit posts

Is it possible to make a Facebook app which edits user's post on his wall automatically (edits EVERY POST that user makes, app has user's permission and everything)
I don't think that's possible, but maybe I'm wrong?
Based on the Graph API docs, I actually think it could work.
Get the extended permission called
"offline_access". See
http://developers.facebook.com/docs/authentication/permissions
Periodically pull from
https://graph.facebook.com/PROFILE_ID/feed
to see if the user has posted new
posts.
If so, for each new post that has appeared:
Pull and store the text of the post.
Manipulate the text as desired.
Delete the original post using
"DELETE". See
http://developers.facebook.com/docs/api#deleting
Publish your modified version of the
post using "POST". See
http://developers.facebook.com/docs/api#publishing
#Jon: You cannot delete a post that your application has not published.
See here: https://developers.facebook.com/docs/reference/api/post/
No, it's not possible for security reasons. Even though you probably have the best of intentions, there are lots of people who unfortunately don't. The few ruin it for all.