pH7Software / pH7-Social-Dating-CMS

šŸ˜» pH7Builder (formerly pH7CMS) is a Professional & Open Source Social Dating CMS written in PHP 8 šŸš€ This Social Dating Script aims to be low resource-intensive, powerful and secure. pH7Builder includes over 40 modules. It is the first Professional, Free & Open Source Social Dating Site Builder Software and the first choice for enterprise level Da
https://pH7Builder.com
MIT License
972 stars 579 forks source link

Everyone can update all galleries from all users #699

Closed patmin closed 4 years ago

patmin commented 4 years ago

Every user can go to another userprofile and update the gallery with own pictures

Undefined-Variables commented 4 years ago

This is not true! Yes when you are on another users profile you can see the add a new album button but If you click and add a new album the resulting album is owned by the person who created it!

This is not a bug and causes no problem but if you would prefer only to see the add button if you are on your own profile go to the Profile module find the button and add something like this around the add album button

{if $is_logged && $is_own_profile}

Buttons code here!!!

{/if}
aruanaweb commented 4 years ago

This is useful for me too, because i also don't want to see the button in others' profiles. It doesn't make much sense. Thanks for the tip!!

raskander commented 4 years ago

Hi! ok I add the above code into app/system/modules/cool-profile-page/controllers/maincontroller.php

{if $is_logged && $is_own_profile}

<a class="btn btn-default btn-md" href="{{ $design->url('picture', 'main', 'addalbum') }}"> {lang 'Ajouter un Album'} </a>

` {/if}

But it removes the "Add Album" button for all. My profile and when I visit a profile.

Can I possibly get a pointer as to where I should be adding the exception so I do not see the "Add Album" buttons on other peoples profiles except mine.

Thank You kindly.

-R

Undefined-Variables commented 4 years ago

Needs to go around the button in view!

I will give you better instructions in about half out when Iā€™m home

raskander commented 4 years ago

ok thank you kindly, I will fiddle around with it apologies for editing, code brackets are giving me a hard time

raskander commented 4 years ago

Alright i am still at a loss with this one, I have found 2 suitable places: /app/system/modules/picture/views/base/tpl/main/index.tpl and /app/system/modules/picture/views/base/tpl/main/albums.tpl sadly, adding the code still removes the Add Album link on my own profile

I will wait for your input

Thank you again for your assistance.

-R

Undefined-Variables commented 4 years ago

You need to remove what ever you have done in the controller. Then go to this file...

/_protected/app/system/modules/cool-profile-page/views/base/tpl/main

On about line 170 you will see this...

<p class="bottom center"> <a class="btn btn-default btn-md" href="{{ $design->url('picture', 'main', 'addalbum') }}">{lang 'Add Album'}</a> </p>

Change it to this...

{if $is_user_auth && $is_own_profile} <p class="bottom center"> <a class="btn btn-default btn-md" href="{{ $design->url('picture', 'main', 'addalbum') }}">{lang 'Add Album'}</a> </p> {/if}

Now you will only see the button if this is your own profile!

Undefined-Variables commented 4 years ago

Capture

raskander commented 4 years ago

ok thank you for your assistance I am not sure I have the right version at this point as I do not have the p class="bottom center" tag anywhere instead I have a p class="bottom" in /app/system/modules/picture/views/base/tpl/main/index.tpl

raskander commented 4 years ago

If I add the code to the part i mentioned which looks exactly the same as yours except for the bottom center tag then it remove all "Add album" buttons for everyone

Undefined-Variables commented 4 years ago

You must have the "Add Album" in that file somewhere or it wouldn't be on the profile at all. Open the page with a text editor and search using find (ctrl + f on most editors) then search for Add Album.

Once you have it all you have to do is add the {if $is_user_auth && $is_own_profile} above it and the {/if} below it.

If you are still unable let me know and I will help tomorrow, I have taken my meds now so will be asleep soon...

Undefined-Variables commented 4 years ago

Okay sorry things have been moved around a little so open this file...

_protected/app/system/modules/picture/views/base/tpl/main/albums.tpl

And add the following from line 32 to 37


{if $is_own_profile && $is_logged} 
<p class="bottom">
        <a class="btn btn-default btn-md" href="{{ $design->url('picture', 'main', 'addalbum') }}">
            {lang 'Add a new album'}
        </a>
</p>
{/if}
raskander commented 4 years ago

Hi Undefined-Variables, Thank You for your assistance. I did the modifications onto _protected/app/system/modules/picture/views/base/tpl/main/albums.tpl then deleted the caches and rebuilt (just in case) and sadly the issue remains. It removes the Add Album button on my own profile also.

Thank you again,

-R

Undefined-Variables commented 4 years ago

Go here and add this...

_protected/app/system/modules/picture/controllers/MainController.php

At line 114


            $this->view->is_logged = $this->bUserAuth;
            $this->view->is_own_profile = $this->isOwnProfile();
Undefined-Variables commented 4 years ago

then try again

raskander commented 4 years ago

Hi again, Thank you for your reply, at line 114 in MainController.php i have <$this->view->albums = $oAlbums;> If I add the lines underneath, it still removes all the add album buttons, I may not be adding that at the right place? Just a mention since there seems to be many versions...

Thank you

-R

raskander commented 4 years ago

Correction the lines above remove my add album and the picture section on my profile but leaves the add album button on others profiles

Thank you

-R

raskander commented 4 years ago

Hi Undefined-Variables, Hope you are well, Sorry I had to go out for a bit.

After some research I have found the following: anywhere I add the 2 lines of code in _protected/app/system/modules/picture/controllers/MainController.php makes the entire picture block vanish in profiles.

I looked around and found the same 2 lines of code in app/system/modules/cool-profile-page/controllers/MainController.php at line 100 and 101, also in
app/system/modules/user/controllers/MainController.php at line 117 and 118.

If I only add the IF code onto _protected/app/system/modules/picture/views/base/tpl/main/albums.tpl the picture block is showing but no Add Album button for anyone

Thank you kindly,

-R

Undefined-Variables commented 4 years ago

Hey @raskander I will have a look into this more. Iā€™m just unable to look at the minute as I have had a hard drive failure on my machine but currently rebuilding from a backup so shouldnā€™t be too long!

Try just using the $is_own_profile variable on its own in the place you say leaves the images but takes the button away for everyone! There is definitely a simple way to do this cos Iā€™ve done so myself it was just a while ago!

raskander commented 4 years ago

no problem! Thank you for your help. I have finally added this < {if $is_user_auth AND $member_id == $album->profileId} > ....button code .... < {/if} > and it works! Now the strange part is that i cannot get the video album albums.tpl to work properly either and it is the same code! this too removes all add video album buttons. i will continue to look and try.

Thank You again!

-R

Undefined-Variables commented 4 years ago

@raskander Okay finally am back up and running and I have solved this for you. You are going to have to make a few changes to get this to work... I will also explain why my previous suggestions failed at the end of this post... Ready?

Open this file

/public_html/_protected/app/system/modules/picture/views/base/tpl/main/albums.tpl

Delete everything between lines 33 and 37 but be sure to leave the closing div tag in place...

Now open

/public_html/_protected/app/system/modules/cool-profile-page/views/base/tpl/main/index.tpl

And put this code at line 171


            <p class="bottom center">
                <a class="btn btn-default btn-md" href="{{ $design->url('picture', 'main', 'addalbum') }}">
                        {lang 'Add a new album'}
                    </a>
                 </p>
               {/if}

It should now look the same as below...

IMAGE IS BELOW

You now have the button on profile page only if its your own profile :)

The reason `$is_own_profile` doesn't work is because the function is located in
ProfileBaseController and MainController that is in picture module only extends controller
where the MainController in in Cool-Profile-Page extends the ProfileBaseController which is
later on in the code. We were trying to use it before it had been declared as a function... Great stuff :)

Hope this helps you :)
Undefined-Variables commented 4 years ago

Capture

Undefined-Variables commented 4 years ago

@raskander Just seen your reply and yes that is why I didnā€™t do it that way! Thought you wanted both and knew video would not work out like that! Iā€™ve given you an example that will work with both! I know cos Iā€™ve done so myself šŸ‘

Best of luck!

aruanaweb commented 4 years ago

Hi folks. I will try this solution on my own installation and let you know. Thanks

raskander commented 4 years ago

Hi! Thanks for joining in, So far I have implanted the solution for the photo part and although it does work in 'View own profile' and does not display the button on other's profiles. It also removes one's Add Album button in the user's dashboard.

I can live with this for now, I will just redirect users to 'View Own Profile' if they want to add pics and vids

Thank You kindly for your help

-R

Undefined-Variables commented 4 years ago

@raskander What user dashboard? If you followed my instructions it does exactly what you asked for!!!

Undefined-Variables commented 4 years ago

If you have made other custom edits to the software Iā€™m afraid we are not able to foresee how anything will work with in your website. I lost my crystal ball šŸ”®

raskander commented 4 years ago

Hi Undefined-Variables When the user logs in the default landing page for that user is localhost/user-dashboard/main/index the buttons to add albums are not there. If user clicks in top menu , my account, then view my profile the buttons to add albums are there. If I check another profile it works, no buttons because not my profile. It also works if one clicks the Video or Picture in the top menu.

So no Add Album in the user dashboard but like I mentionned, i can live with this

Thank You again

-R

raskander commented 4 years ago

Also, no edits or crystal ball required apart from the above code and the complete revamp of global file for french language and that part works properly.

Thank You!

-R

Undefined-Variables commented 4 years ago

Haha I was only playing around! I donā€™t use the user dashboard and have my landing page as meet-people (browse) so didnā€™t consider it but I donā€™t like to leave things half done so I will look when I have a free 5minutes and I will update this post!

polynamaude commented 4 years ago

@raskander Hi ! If you edited the French translation then it would be interesting that you share it with us too.

Undefined-Variables commented 4 years ago

I have to agree this is a give and take relationship! Thatā€™s what open source is about :)

raskander commented 4 years ago

Wow! , I would be honored, Considering I am a complete neophyte who is learning on the stack. I will share the file when I get home from work tonight. It was revised to French Canadian for the Province of Quebec.

Thank You again guys Have a great day

-R

raskander commented 4 years ago

Wow! , I would be honored, Considering I am a complete neophyte who is learning on the stack. I will share the file when I get home from work tonight. It was revised to French Canadian for the Province of Quebec.

Thank You again guys Have a great day

-R

polynamaude commented 4 years ago

@raskander Could I ask what you changed in the language file ? Because unless you didn't take the time to look at the French Canadian translation, I doubt there was much to be done.

I've checked it out last year....

https://github.com/pH7Software/pH7-Internationalization/tree/master/_protected/app/langs/fr_CA

And translated it two years ago....

https://github.com/pH7Software/pH7-Internationalization/blob/master/_protected/app/langs/fr_CA/LC_MESSAGES/global.mo

There's a difference between using "slang" as we say it or "patois" in proper sense and using correct french. We ain't gonna be using things like "Une ouature" or "menƩ menƩ en vroum vroum"....

Oh by the way, I'm from Montreal.

raskander commented 4 years ago

Hi Polynamaude Sorry I did not mean to offend anyone, There is no slang but there are errors, also changes were made in the translation for clarity.

I am from Repentigny. On va aller menner le ouaouaron en char pis aprĆØs, on va aller ajuster les breaks su l'chat! ;-)

Thank You again for your assistance,

-R

Undefined-Variables commented 4 years ago

I take my hat off to you @polynamaude that is one long winded task, that file is a monster!

I once started to work my way though it to put the correct British grammar and to way of putting things. Just like you are explaining to @raskander a little is lost in translation between languages. For example the order that words are used slightly differs. You can learn a language though study but until you live in a place that uses it as the primary language you will never fully understand it completely.

I will do it one day when I am less busy I promise :)

polynamaude commented 4 years ago

@Undefined-Variables Yes that's the art of context based translation. That's why it's better to segment your sentence in word that you translate one by one. And even there, you still have the problem that they'll need to fit properly in the context so you often have to change the position of them too. So in the end, you go back to translating string but you put the variables part at different location following what language.

You are true for English. When I first moved from Ontario to Nova-Scotia and heard someone say to me "What's up with you ?" I was asking myself if he was asking me where was I going !?

I was thinking that it was mostly UK English as PH is in England... Even there's probably some differences between Scotland, the Irish part of England, England itself and the channel island too.

@raskander No you didn't offend no one here. Just saying that maybe you did what was already done. Anyway, just create your own repository and push it. Even if it's somewhat loose talk, people may still be interested because I've had many complaints that I speak a too correct French and that make people feel like I'm self contempting.

Cheers

Undefined-Variables commented 4 years ago

@polynamaude Yes language is a very complicated thing, more so than programming could ever be, with programming all languages point to a single goal (101010101010) but language has no such focus.

You just provided a perfect example... In French "You are true for English..." most likely makes perfect sense but here we would say "You are correct about England..." You are not wrong about England, Scotland, Ireland and Wales we might as well have oceans between us, its not just between the counties either different parts of the UK struggle to understand each other, A few miles down the road can feel like another language.

Why would PH want to be here? Its cold and miserable 95% of the time, he has a skill he can take anywhere in the world. I am only here because I have to be...

polynamaude commented 4 years ago

@raskander So how's your translation going on?

raskander commented 4 years ago

Hi Polynamaude,

Stalled for the moment, I am away on business. I will resume at the end of this week and should have it ready by the weekend.

Have a great day!

-R

Sent from my LG phone using Raskander's Mail

On Mon, Feb 24, 2020, 00:11 Polyna-Maude R.-Summerside < notifications@github.com> wrote:

@raskander https://github.com/raskander So how's your translation going on?

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pH7Software/pH7-Social-Dating-CMS/issues/699?email_source=notifications&email_token=AJXNJEU2AETFRVMV5TJOGKLRENJH5A5CNFSM4KPRPJK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMWUMXQ#issuecomment-590169694, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXNJEV3CFI23QUYPMEOU3TRENJH5ANCNFSM4KPRPJKQ .

polynamaude commented 4 years ago

Hi @raskander , Take you time, no hurry there. How's your site implementation going ? You're up and running ? Because it's soon going to be summer time and people will need to match and mix. Or you can say... that it's gonna be time to "Jiggle the fatty in the bottom of a wooden box". (Swing la bacaisse dans l'fond de la boƮte Ơ bois).

PM

Undefined-Variables commented 4 years ago

@raskander Sorry I forgot to reply but it is possible by doing the same thing in the video module as you have done in the picture module! If you get stuck reply to this and I will help you further...

pH-7 commented 4 years ago

Wow, thank you SOOO much for your amazing help @Undefined-Variables!!! You rock! šŸš€

Unfortunately, ProfileBaseController::isOwnProfile() function only works on profile controllers. Video and Picture modules don't have any idea if it's your own albums or not.

What cool-profile-page and user modules do, is just ajax request the data from video and picture modules and place their results into the profile page.

I will publish a fix to this very soon :smiley:

pH-7 commented 4 years ago

I once started to work my way though it to put the correct British grammar and to way of putting things.

I will do it one day when I am less busy I promise :)

Wow!! This would be really really great!! šŸ¤—

Undefined-Variables commented 4 years ago

Wow, thank you SOOO much for your amazing help @Undefined-Variables!!! You rock!

Unfortunately, ProfileBaseController::isOwnProfile() function only works on profile controllers. Video and Picture modules don't have any idea if it's your own albums or not.

What cool-profile-page and user modules do, is just ajax request the data from video and picture modules and place their results into the profile page.

I will publish a fix to this very soon

Hey @pH-7 no worries I like to help out other users where I can :) I was going to push this myself but seem to get a lot of ear ache when I point things out so just going to stick to the helping others for now. I am up to my neck in video, ffmpeg and conversion at the minute. This is something I will share once I have completed my work. You can rest assured I will always be here to help you provide support for your software. Its the least I can do after all it has taught me and the lessons I have gained from it :)

Undefined-Variables commented 4 years ago

I once started to work my way though it to put the correct British grammar and to way of putting things. I will do it one day when I am less busy I promise :)

Wow!! This would be really really great!!

This is on my list of things to do :) Soon as I have some free time :)

lock[bot] commented 4 years ago

Hi there, I locked the thread since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Thank you, Pierre-Henry Soria šŸ¤–