Hi LA Drupalers,
I am posting a question and I'm hoping to get some help with Panels/Advanced Profile kit.
Here's the situation. I have a panel using advanced profile kit (really just a panel that was created by APK and I tinkered with it) with one variant.
The current URL for all profiles using that panel is /profile/user/%name
I would like to change the url to /profile/user/ city from cck field / state from cck field /%name
How would I do that? If that is even possible.
I have a feeling it has something to do with adding arguements.
I'm at a loss. I don't use panels that often and I don't know all the ins and outs of it. I much more comfortable with views.
I have attached the exported code from my panel page if you are interested.
Thanks in advance.
| Attachment | Size |
|---|---|
| Panel problem | 2.04 KB |

Comments
Attempting a solution ...
With the disclaimer that I am completely new to panels / APK, I would like to propose a mini experiment to come to grips with the problem.
In blutospanel.txt file, there is the following line
$page->path = 'profile/user/%name';
Try changing it to
$page->path = 'profile/user/foo/bar/%name';
Now, if the url has changed to profile/usr/foo/bar/%name, then you know that it is possible to change the urls to what you want. Then it is a matter of replacing foo and bar with city and state from CCK.
Good Luck.
Thank you.
Thanks for responding. How can I do that and make it dynamic for each user? %name puts the users username in the URL. I need the site to also put in each users unique city in the same way. What do you think.
Did the path change to
Did the path change to include /foo/bar in it? If it did then we are on the right track.
The following piece will let you locate the city field. Try adding it in profile.tpl.php file (quite safe there).
<? global $user; ?><? profile_load_profile($user); ?>
<pre><? print_r($user); ?><?pre>
You can then go to your profile page and look at the contents.
Try playing with the following piece of code until you can extract just the city.
<?php $fieldname = 'profile_city'; ?><?php if($account->$fieldname != ""): ?>
<div class="fields">
<strong>City:</strong>
<?php
$values = split("[,\n\r]", $account->$fieldname);
$fields = array();
foreach ($values as $value) {
if ($value = trim($value)) { ?>
<?php print l($value, 'profile/'. $fieldname .'/'. $value); ?>
<?php }
}
?>
</div>
<?php endif ?>
At the end, you will have to add this code in blutospanel.txt file, and replace foo/bar with the variable name.
I am sure there must be an easier way than this ... others can chime in ....