Jump to content
TNG Community

Listing of all branches a logged in user is member of


Kare

Recommended Posts

How do I code a script that list all branches which the current LOGGED IN user is member of? 

The list should have these columns (ref the TNG standard branch report): #, Description, Starting individual, Individuals and Families. I want to be able to click the number of individuals in the Individuals column to list all members of the branch (this is possible in the TNG standard branch report). 

Link to comment
Share on other sites

Hi Kare, To find out which branches a current LOGGED IN user is member of you may only need to go to their personal page and it is displayed there.

cap2.jpg

Link to comment
Share on other sites

I know that the branches are listed at the personal page. What I want to do is to add a menu item to the "Your pages" drop down menu of my template 15 based site. The blue meny at the top of the site is fixed, it does not scroll away and it is visible everywhere/at all pages of the site.  When the new menu item is clicked, it should produce the list of branches for the logged in user. But the branches must be 'clickable' as in the TNG standard branch reports, see below (where you can click the number in the Individuals column to produce a list of all members in the branch).

IMG_9303.PNG

IMG_9304.PNG

Link to comment
Share on other sites

jayat1familytree

Kare

A user can only be a part of ONE branch

UNLESS you are using branch names that will have a matching "section"

A user cannot have rights to all of these branches  (AS A REGISTERED USER)

JohnDoe123

JaneDoe345

TomDoe678

 

But the personID of the Registered user could have all of those branches in their person record, but that wont give them rights to those branches.

 

But a Registered User could have in their User Profile the branch name of

"Doe_"

and then that would include all of these branches like;

Doe_John123

Doe_Jane345

Doe_Tom678

 

Link to comment
Share on other sites

"A user can only be part of one branch" ?

I am part of 6 branches defined at my website - 4 branches for my ggrandparents and 2 for my grandparents. All branches are defined as "top down" (with the ggparents/gparents as the starting individual). I have 41 branches defined, which can all be listed and reached from the "Branches" drop down menu. All branches are, however, listed here. I want the current user's branches only to be listed by clicking a meny item at the "Your pages" drop down menu.

Link to comment
Share on other sites

Kare,
     What Jay is referring to is the fact that a user can only be assigned to one branch.  A person can be part of many branches though is your point.  That just means you will have to look at the person table instead of the user table to get the branches the person is part of.
     So your script would have to look at the person ID that is assigned to the user, then go do a lookup of the branches assigned to the person ID, then do a browsebranches display but only display it if the branch is contained in the branch list that has been looked up.

Brent

Link to comment
Share on other sites

Thank you Brent. Yes, that is what I want the script to do. But to write it is the challenge, and that is where I could need some help...

Link to comment
Share on other sites

jayat1familytree

Kare,

I guess I am confused as to why you use top down?? But whatever works best for you...

personally, I would assign you to one branch, you as the starting person,

5 gen, 5 desc of gen and 1 desc is my default setting tho' many times I have to increase those where the generations are many more than just 5 .

I am working a MOD that would display all persons in a branch

 

view_branch_user_email.jpg

It also shows the user(s) attached to that branch and if you mouseover the users name it will display their email in the lower left corner

So that my Registered users can also connect with other Registered users researching the same families.

 

Link to comment
Share on other sites

Your MOD looks impressive and should give all the info I would like to give the users of my site. I would be interested in testing your mod if possible.

Kåre

Link to comment
Share on other sites

Kare,
     It looks like browsebranches already has a function in it that would do what you want.  The format to search for branches is browsebranches.php?branchsearch=Branch1!Branch2!Branch3!Branch4.  I have attached a copy of browsebranches where I added lines 14-21 that get the data to add to the query.  When you click search, it takes you back to the main browsebranches page, but since it has the search string added to the url ends up using the built in query.  So maybe this can get you headed in the direction that you want.

Brent

browsebranchesonlymine.php

Link to comment
Share on other sites

jayat1familytree

Brent that is a great report! 

How would one add the 'personID' on the results  (Just to clarify what was the basis for the results.)

Maybe on the line (about 107)

    echo "<p><span class=\"normal\">{$text['matches']} $offsetplus {$text['to']} $numrowsplus {$text['of']} $totrows</span></p>";

add

    echo "<p><span class=\"normal\">{$text['matches']} $offsetplus {$text['to']} $numrowsplus {$text['of']} $totrows {$text['for']} {$text['personid']} personID number  - Person ID Name  </span></p>";

Matches 1 to 5 of 5 for personID   I12345 - John Doe

I am not a coder so unsure of the exact syntax needed

Thanks in advance for any help!! 

Jay

Link to comment
Share on other sites

jayat1familytree

Brent,

Thanks so much for that....

An FYI for everyone

That personID displayed is the the one attached to the USER record and NOT the "start" PersonID of the branch. 

(would be great if we had both)

 

 

Link to comment
Share on other sites

jayat1familytree

Brent, also FYI 

When I have used the page script browsebranchesonlymine.php  and go to click on logout  i get a this page doesnotexist....  not sure why?

On my site, login with user   1familytreeguest   and pw  = FamilyTreeGuest123   to see.

Thanks

 

jay

Link to comment
Share on other sites

Jay, the starting person for each branch is listed next to the branch description in the column titled "Starting Individual".  So you do have both.

Line 17 is causing the behavior you are seeing.  If a user is not logged in, it redirects to thispagedoesnotexist.html  This works if you have require login set to "Yes", since that ends up redirecting you to index.php on logout and if you followed a bookmark/favorite/manually typed the address takes you to login.php.  For an open site, it should probably take you to login.php instead though.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...