How to get item ID under "INTERESTS" - facebook-page

I am developing an application to get images from the specific Facebook page registered under "INTERESTS" node displayed in the left menu area of the top page.
So I want to get the ID of the menu item under "INTERESTS".
I can find a way to get "Interests" of user's profile, but it is different from "INTERESTS".
Please someone let me know how to get it.
Thanks,

I tested it with a new list of my own. If I copy the link address and query the Graph API for the id it contains, I get something like this,
{
"id": "…",
"name": "test",
"list_type": "user_created",
"type": "friendlist"
}
But I can not see it under /me/friendlists, no luck finding a connection somewhere using FQL either. Can’t tell if it’s not showing up because the type is "user_created" (maybe?) …

Related

How to display visitor's name by just url?

I need help to display website visitor's name (on the popups) by just url?
For example this wordpress website:
https://ngantenstory.id/agus-henny/?u=Jonathan
You can change the name to anything and it will display the exact name on the welcome popups.
No need user database, I assume? No need for the user to register first, etc.
How to do this? Please help.
Thank you.
alert(new URLSearchParams(window.location.search).get("u"))
You can get current page's URL by using window.location,
get it's "search parameter" ("?u=Jonathan"),
and parse it by create an URLSearchParams object,
then get what you want by using get method,
finally use alert or other thing to show it to user.
alert is just for a simple example, don't use it in production, you may want set one of your HTML node's content and style instead.

How do I create a new page for each user?

I need to create a new page for each user on signup so when you go to the site's explore page and click on someone's name or picture, it will take you to their specific page and display their data. (database is firebase firestore and firebase storage, saved link to each person's doc)
This is one of the issues I've been trying to fix for about a month(just fixed the explore page issue and got everyone profile pic to display with that individual user's name right below). I have tried making a new html page with someone's php and js script (didn't work, not familiar with php) and url rewriting.
I haven't been able to find anything else concrete or at least something else to point me in the right direction. Any pointers or tips?
(Vanilla/node.js)
With PHP, on clicking a persons username you can add the username as a parameter to the url e.g yoursite.com?user=personsusername then use GET method to retrieve the username and output data relating to that username from the database

Wordpress backend design

I have to build an "admin only" page where an admin user can input 3 objects - a person's "name", "description" and a photo. this way they can add/edit/delete people from the website.
I have tried adding "add_menu_page()" to the admin navigation menu and that worked, but I'm kind of lost as to what to do next, or even if I'm on the right track.
I'm assuming I will load the people into the WP database and query the database when i need to display each person.
Yes you are on the right track. Just create a form for the admin where he/she can enter the name, description and photo of a person.
You should make another page using the same method i.e. add_menu_page() and load your WP DB there and provide the option to the admin to delete, edit or add from there.

Is there a Drupal module that can redirect from root URL to a certain page?

I wonder if there's a Drupal module that can do this kind of functionality: if i go to home page, it will take me to some subpath within the site. i.e. www.something.com will redirect to www.something.com/product/node/11.
I tried creating an alias and used Path redirect module but for some reason, i can't reach the expanded URL when going to home page. it will display the content of www.something.com/product/node/11 but still using www.something.com.
I'm thinking that this can only be implemented in Apache server, not inside Drupal?
Note that our purpose of doing this feature is whenever a new product is created, we want our home website to point to that (i.e. www.something.com -> www.something.com/product2/home, before www.something.com/product1/home). If this is configurable inside Drupal, the changes would be easier and can be done by a Drupal administrator.
You should be able to go to /admin/settings/site-information and set the Default Front Page at the bottom of the form. That doesn't do a redirect: the home page will BE whatever you set the default to.
Create a new view (Node type) named "frontpage_redirect"
As suggested in answer by Michael D, create and save a view configured to search for your specified criteria:
display: page display, path = frontpage-redirect
pager: 1 item
row style = Fields
fields: Node => Node ID
filters: node type = product
sort: post date desc
Save your new view
At admin/config/system/site-information, set your "Default front page" to the view display path above (frontpage-redirect in my example)
In the view edit screen select "Theme: Information" link in the Page display. Look for the most specific (rightmost) entry under "Field Node: Nid (ID: nid)" - should be something like views-view-field--frontpage-redirect--page-1--nid.tpl.php, but will depend on the view name and display name. Copy the default views template views-view.tpl.php into your theme folder using the filename from 3.
Edit the template and put this code in it:
if (isset($row->nid)) {
drupal_goto('node/' . $row->nid);
}
This way of setting up the redirect lets you drive it from Views, which gives flexibility. When your customer decides in six weeks that they want to feature only the latest red product on the frontpage, you'll be able to update the logic behind the redirect using the views UI. (And you can do it from your phone on the train home!)
You avoid the need to create a custom module (which is easy enough, but does add some complexity) or to move your site logic into .htaccess.
Using the Views module, create a new view that displays one full node, ordered by last created, filtered appropriately, then create a page display in the view. Then follow Graham's instruction to set the site homepage to the view URL.
Another way would be to write a very simple custom module that db-queries for the latest node created of the sort you want, grab the URL to the page, then redirect there using drupal_goto().
There are other ways to do what you want inside Drupal, but I can't think of any that are more direct and simple at the moment...
What you are asking seems wrong. Sorry if I misunderstand some detail, but it seems you should reconsider the problem on a higher level.
If I understand you right, you want to show the page for the latest product as the homepage?
If so, maybe you should turn that into show the latest project page on the homepage. That fits a lot better with the RESTfullness of the web. And with expectations of the users.
The pattern would then be:
GET /products/22 shows product 22
GET /products/23 shows product 23
GET /product/latest shows the last product (in this case, the page would be exactly similar to /products/23)
To achieve that, you can use views module.
On similar lines to Michael D's post, assuming you want to pull the most recently published product from a custom content type called "products," you could put something like this in your settings.php:
function yourtheme_preprocess_page(&$variables) {
$query = db_query("SELECT nid FROM {content_type_products} ORDER BY nid DESC LIMIT 1");
while ($row = db_fetch_object($query)) {
$redirect_nid = $row->nid;
}
if ($variables['is_front'] == 1) drupal_goto("/node/" . $redirect_nid);
}
modify the .htaccess file.
http://drupal.org/node/50322#comment-2456576

Drupal - heartbeat - Avatar

Im trying to add the avatar into my heartbeat stream, or any additional token for that matter and I dont seem to be able to get it working.
I've edited the default message template "User adds a node, save user activity". Here is what ive setup as the single message
!avatar !username has added !node_type !node_title. !mail
Then in rules ive setup the following variables:
#avatar=[author:heartbeat-user-picture]
#username=[author:user-name-url]
#node_type=[node:type-name]
#node_title=[node:title-link]
#mail=[author:mail]
#types=[node:type-name]
I then use display suite to theme my heartbeat streams. But instead of getting the Avatar to display or the Authors email address I get the actual tokens.
My messsage I get is as following:
!avatar ankh2054 has added the following journal: test and journal entry . !mail
Any help would be appreciated.
I looked further and I found the issue, but still a little puzzled of how I can fix it. The reason is not displaying the picture is because I am using a custom node & content profile for my user profiles & therefore have assigned a custome CCK field for the user avatar. Display suite seems to only pickup the default picture that is assigned via the built in Drupal profile.
Any ideas ? thanks for yuor help so far :)

Resources