This site uses cookies and similar technologies.

If you don't change browser settings, you agree to it.

I understand
1 Post
adistans
6 years ago
Topic

Hi,
We have a project that displays a user profile with this type of url: index.php?option=com_profile2&user_id=1234
We added fields to the user profile with SEBLOD, and we created a list view of all users...
Nous avons ajouté des champs au profil utilisateur avec Seblod, et créé un affichage en liste de l'ensemble des utilisateurs... but we can not find how to add link from an item in the list to its content view.
Thanks in advance !

Get a Book for SEBLOD
6 years ago
0
Level 1
Hi adistans,

You are in the item or list view of your search type. To add this type of links, you should:
  • click on button "2"
  • select the option "view" under "Content option group" for your field.

You finished with these two steps the construction of your link in the list.

Regards,
Mehdi.


5 Posts
aymeric
6 years ago
0
Level 1


Hi,

Thanks for your reply, after doing this 2 steps on our "firstname" field no link appeared in the list displayed in our website.

Any advice ?

Thanks

6 years ago
0
Level 1

Ok,

I forgot something.

To have a link to a user profile as you want, you should enable bridge between user object and article which contains the profile of a user.

To enable a bridge, you should:

  • click on admin menu link "extensions"
  • click on admin menu link "plugin manager"
  • filter plugin by the type "cck_storage_location"
  • click on plugin "Cck Storage Location - Joomla! User"
  • In "basic options" panel, enable the bridge.

Regards,
Mehdi.

5 Posts
aymeric
6 years ago
0
Level 1

Hi,

Thank you for taking some time for us.
After enabling the bridge between user object and article our link are well displayed.

Nevertheless, the edit button displayed on user profil (into a profil) an unauthorized access error is displaye (403). This error appeared even when i'm log with my admin account.

How we can have a link to edit profil form ?

Thanks

211 Posts
cubist
6 years ago
0
Level 1

I answered the question of this post although using item view and the sdsimplesimon template.

But I am still not thinking pure Seblod. I look forward to Mehdi's next reply.

6 years ago
0
Level 1

Hi cubist,

When you would like to have a menu link to edit the profile of the logged user, you don't need to all you say in your previous post.

In order to do add this menu link, you should add an "Edit User Profile" under "User Manager". That's it.

No more code and so on.

Regards,
Mehdi.

5 Posts
aymeric
6 years ago
0
Level 1

Hi Mehdi,

Thanks for all your answer and advices !
Our edit link work well with the "free text" link.

3 Posts
arnaudco
6 years ago
0
Level 1

I try this but it's doesn't works.

I want to include a link to access user profile in article, the link appeare but when i click on I move to article and not user profile page (view only).

I try to include in my article some user field (username, use rid) but I get this error JUser: :_load: Unable to load user with ID: 27


27 is not a user id but the article id.

I really want that you help me.


Thanks a lot.

6 years ago
1
Level 1

Hi Everybody,

Well, the edit button you are talking is managed and displayed by joomla, not by seblod.

In this context, i advise to hide this button.

After that, if you would like to have an edit button (in your content view or in your list view), you can

  • add a "free text" field in your content and/or list view. You should set a default value for this field. For example "edit"
  • you click on button 2 in your content, list or item view
  • select for this field option "form"

Save your content type or your search type settings

You have now an edit link in your content or list view.

Regards,
Mehdi.

211 Posts
cubist
6 years ago
0
Level 2

I wanted a main menu item that would allow users to edit their own profile. To do this it required more than I thought originally.

I found if your Content Type (for a User NOT an Article) permissions are set as "edit own", Seblod does NOT work. You get a "You are not allowed to access this resource" error. Anyone else confirm this?

So you must set permissions as "edit". However, this means ANYONE can edit anyone's profile merely by editing the id of the URL, e.g. option=com_cck&view=form&layout=edit&type=applicants&id=64&Itemid=38. Not so desirable...

So, I wrote some code that allows you to put an "Edit My Profile" link in your menu. Some caveats:

  • You must put the code at the top of your master template
  • Your content type is saved from the standard User Content Type
  • The code below assumes you want Registered users ONLY to edit their own profile

Also, p.s.  I have read across the forums (v2 & v3) Joomla does NOT allow you to view User Details as pure content. Admins is this TRUE?

define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$mainframe->route();

$user =& JFactory::getUser();
$usrid = $user->get('id');
$grparray = $user->get('groups');

$sum = count($grparray);

for ($i=0; $i<$sum; $i++) {
 $grpid = $grparray[$i];
}


$getGroups = JAccess::getGroupsByUser($usrid);

$sum2 = count($getGroups);

for ($i=0; $i<$sum2; $i++) {
 $newgrpid = $getGroups[$i];
}

// Append associative array elements
function array_push_associative(&$arr) {
   $args = func_get_args();
   foreach ($args as $arg) {
       if (is_array($arg)) {
           foreach ($arg as $key => $value) {
               $arr[$key] = $value;
               $ret++;
           }
       }else{
           $arr[$arg] = "";
       }
   }
   return $ret;
}

//$selfUrl = $_SERVER['PHP_SELF'];
$urlCCK = array();
foreach($_GET as $key => $value) {
    array_push_associative($urlCCK, $items = array("$key" => "$value"));
}

// IF current user is in the Registered Group and their id is NOT equal to the URL's, then there's a problem.
if (
	($newgrpid         == 2)            &&  // you may need to tweak this for ACL
	($urlCCK['option'] == 'com_cck')    &&
	($urlCCK['view']   == 'form')       &&
	($urlCCK['layout'] == 'edit')       &&
	($urlCCK['type']   == 'applicants') && // makes this the name of your CCK User Profile form
	($urlCCK['id']     != $usrid)
) {
header('Location: index.php'); // go to a page you set
exit;
}

Get a Book for SEBLOD