Drupal 5: Flag module - display user flagged items in a block - drupal

I am aiming to get a list of the current user's flagged items in a block which I can use in my node.tpl.php The functionality required is a "comparison list" of products.
Can anyone with experience of the flag module in D5 point me in the right direction? I essentially want to be able to say:
<?php print $all_current_user_flags ?>
Is there a predefined function for this or will I have to get it out of the database manually? I haven't managed to find much in the documentation about this, and am I bit stuck as to what is the best course of action.
Thanks in advance.
Edit: to anyone still reading this, I've moved over to the session favourites module as it lets anonymous users build a list of favourites.

This works:
<h3>Comparison List</h3>
<?php print views_build_view('page',views_get_view('flag_bookmarks'),$args,true,10,$page); ?>

Related

Smart IP module - how to check what every country sees

Unfortunately i don't have too much experience with drupal so please feel free to ask for more information if needed and i will provide.
I am using Drupal 7.34 and i have a module installed called Smart IP. I have different blocks which are shown depending on the users IP/Location/Language.
For example, when editing a block, going to the Show block on specific pages -> Pages on which this PHP Code returns TRUE (experts only) with the below code :
<?php
$smart_ip_session = smart_ip_session_get('smart_ip');
if (isset($smart_ip_session['location']['country_code'])){
if ($smart_ip_session['location']['country_code'] =='GR' && drupal_is_front_page()){
return TRUE;
}
}
?>
The above block will be shown if it's a drupal_is_front_page()) and if country_code is GR.
Since i am from Greece, the specific block is going to be loaded. How can i check how the block of another country looks like?
A couple of options:
If you know already how you want this function to behave then use dependence injection to return a mocked version of this object.
This will allow you test the rest of the application using whatever country's settings you like.
Or, if it is this function itself you need to test then use a VPN to request the page from another country.
e.g. https://www.operavpn.com/ or https://chrome.google.com/webstore/detail/unlimited-free-vpn-hola/gkojfkhlekighikafcpjkiklfbnlmeio
Both free to use.

Using t() in Drupal 7

I've searched how to do it a week, but haven't success and it's been a bottleneck in the work so, I decided to ask.
I put <h3><?php print t("strings translation"); ?></h3> in page.tpl.php and flush all caches and reload every languages available in the site.
And then I try to search for the string in /admin/config/regional/translate/i18n_string the options available are Fields, Node types, Menu, Taxonomy, Blocks.
But then I can't find the "strings translation" in /admin/config/regional/translate/translate.
I have read in drupal.org documentation but it seems like I'm missing something.
Could you please advice how to do it?
Here is the way:
1) Drupal should know that a string is 'not translated'. To make it aware of this, you need to visit the page having the string and change the language. Once you do, Drupal will be aware of all those strings on the page which are not translated to the language selected currently.
2) Go to translate page, search for the string, it should now appear there
Are you missing echo in your code?
<h3><?php echo t("strings translation"); ?></h3>
I am not clear what are you looking for. But Stringoverrides modeule may solve your problem. It can translate any string across the project. But, if the string is inside t() function.

How to add fictional category wordpress

I'm trying to do something, on wordpress which i'm not sure is possible.
So basically, I'm using Magic fields for two things. I've created a panel called "Member", and another one called "Member actuality". I've created two categories, member and member actuality which I've binded too magic fields post.
When I go on category (site.com/category/member) member I have the list of all my members.
When I click on one of my members (site.com/memberName) I have the description of the member. So for the moment everything is ok.
Now what I want to do is find a way too display actuality of one member. Maybe something like : (site.com/actuality/member) But I have no clue on how to do that. So if someone can help me.
I'm not sure i've explained it right, so please if you didn't understand ask me to reformulate.
Thanks for your future help
I found a way to do go throu this.
I've first created a new tag when a post was added, and that allowed me to use the tag directory which i didn't used before !
!

WordPress: How to link the name of an author to that author's list of posts

I'm setting up a WordPress blog and I can't manage to link an author's name to the list of posts written by that author.
I am using this code:
written by <?php the_author() ?>
But this gives me following error:
Warning: Missing argument 1 for get_author_posts_url(), called in /customers/zinneket.be/zinneket.be/httpd.www/wp-content/themes/zinneket/index.php on line 15 and defined in /customers/zinneket.be/zinneket.be/httpd.www/wp-includes/author-template.php on line 220
Line 15 is of course the one copied above.
Does anyone know the right way to do this?
Thanks a lot.
The documentation makes it fairly clear that you need to provide an argument (to identify what author you're interested in).
From the looks of it, the_author_posts_link() is what you want to use.
Rule of thumb: the_ functions involve the current author/post/page/whatever, get_ functions require you to identify what author/post/page/whatever you are interested in.

Drupal 6: getting particular fields from Node Reference types

I'm a drupal newbie...
<?php print $node->field_date[0]['view']; ?>
I can get the custom created CCK fields' value and display in tpl.php files as above... that's fine.
my question is how can I get the Node reference fields' in-fields? for example, I have an event content type, and I have defined Node Reference for Location (title, address, img, etc.). When I write the code below, it displays all location content;
<?php print $node->field_location[0]['view']; ?>
but I need to get only address field from this location content type. sth like below would be great :D but not working;
<?php print $node->field_location[0]['field_address']['view']; ?>
so how can get that? appreciate helps so much! thanks a lot!
You should inspect/dump the content of the $node->field_location array. I do not have a test installation at hand right now, so I can't say for sure, but I'd expect that at least the referenced nodes id ('nid') should be in that array somewhere. With that, you can do a node_load($nid), which returns the full node object, thus providing access to the fields.
(As said, I'm not sure, but the field array might already contain the whole node object as well, saving you from the need to load it explicitely.)
The $node->field_location[0]['view']; returns the node as it was defined in the Display Fields section of the content type definition. This might work for your advantage. You can trick it: use a Teaser display for that node and customize the node Teaser display to fit your needs. Just a thought.
If that doesn’t work for you, you will need to load the node separately. You can use $node->field_location[0]['nid']; to get the node ID, so you will end up with something like this:
node_load($node->field_location[0]['nid'])->field_address[0]['view']
I'm not sure how this performs...

Resources