1

I have a plugin in which once the user shares the page using facebook share button, i need to remove the fb button and display a message that the ' message is already shared', but how do I implement this functionality server side?

  1. user shares the product page.
  2. the page removes the fb button and shows ' page already shared ' but this only need to be done for that particular product and not all the products, hence disabling the fb button on server side is not an option.

1 Answer 1

1

I guess your exact approach would be determined by exactly how important it is that they get that message. Achieving it server side the approach would be required to be something along the lines of:

  • Create a Database Table to Record it (if you expect multiple sharing occurrences moving forward).
  • Create customer attribute to flag they have shared it.

You then set up the share link to trigger an ajax call to record that the user has made triggered the post and modify your blog to detect this either from the database query or customer attribute depending on how flexible your sharing needs to be for future usage.

There is the Facebook Developer documentation as well, https://developers.facebook.com/docs/php/howto/example_post_links which means you could perhaps do the actual post (after getting user permissions granted) from the server side, therefore you can be sure it has been triggered.

2
  • thanks for the heads up! but i dont quite get what you meant by the create customer attribute to flag that they have shared it? dont I need to record the customer id, the product id as well as the coupon code?( not sure about this..). also create a database table to record what?
    – anant
    Commented Aug 16, 2016 at 11:03
  • You want to know that they have shared, so you need to track this information eg customer_id + page_id if it exists in the database its because they have shared therefore you know you dont need to show the share button anymore. Commented Aug 16, 2016 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.