Web based family history software

This Help forum is for issues relates to the latest release (1.6.x). For issues related to beta or github version please use their own Help forum.
Before asking for help please read "How to request help" by clicking on that tab above here.

Question Search and replace

  • Shemwell
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 8 months ago #1 by Shemwell
Search and replace was created by Shemwell
Is there a method to restrict the Search and replace feature to Administrators only?.

Barry

Please Log in or Create an account to join the conversation.

More
8 years 8 months ago - 8 years 8 months ago #2 by Jackie
Replied by Jackie on topic Search and replace

Shemwell wrote: Is there a method to restrict the Search and replace feature to Administrators only?.


Hi,

Open the search.php file (with NotePad++) and edit around the line 116
Code:
//========== Search and replace Search Form ========== if ($controller->action == "replace") { if (WT_USER_CAN_EDIT) {

BY
Code:
//========== Search and replace Search Form ========== if ($controller->action == "replace") { if (WT_USER_CAN_ADMIN) {
Last edit: 8 years 8 months ago by Jackie.

Please Log in or Create an account to join the conversation.

  • Shemwell
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 8 months ago #3 by Shemwell
Replied by Shemwell on topic Search and replace
Thanks... but that gives me an error. I'd prefer not to edit the core code if possible.

ERROR 8: Use of undefined constant WT_USER_CAN_ADMIN - assumed 'WT_USER_CAN_ADMIN'
0 Error occurred on line 116 of file search.php

Notice: Use of undefined constant WT_USER_CAN_ADMIN - assumed 'WT_USER_CAN_ADMIN' in
/home/xxxxxxx/public_html/webtrees/search.php on line 116

I've had two "editors" in the past few years use this indiscriminate feature... of course I rejected the changes. Can I just eliminate Search and replace from the drop down?. I can always use the batch update if needed.

Barry

Please Log in or Create an account to join the conversation.

  • fisharebest
  • Away
  • Administrator
  • Administrator
More
8 years 8 months ago #4 by fisharebest
Replied by fisharebest on topic Search and replace
The check should be
Code:
if (Auth::isAdmin()) { ... }

You might also want to remove it from the menu (in the theme).

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • Shemwell
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 8 months ago #5 by Shemwell
Replied by Shemwell on topic Search and replace
Thanks, that blocks it with a
Fatal error: Class 'Auth' not found in /home/xxxxxx/public_html/webtrees/search.php on line 116. If the Search and replace would let you select what you wanted changed I don't think there would be any issue.

Barry

Please Log in or Create an account to join the conversation.

  • fisharebest
  • Away
  • Administrator
  • Administrator
More
8 years 8 months ago #6 by fisharebest
Replied by fisharebest on topic Search and replace
In that case, you'll probably want to add this near the top of the file

use WT\Auth;

Sorry - there's a lot of difference between the 1.6.2 code and the 1.7.0 code, and I forget which one I'm working with...

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • Shemwell
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 8 months ago #7 by Shemwell
Replied by Shemwell on topic Search and replace
That did it.
Is there any other method other than altering the code?. I've been watching/testing 1.7.0, looks good. How can I make the same changes in it?.

Thanks

Barry

Please Log in or Create an account to join the conversation.

  • fisharebest
  • Away
  • Administrator
  • Administrator
More
8 years 8 months ago #8 by fisharebest
Replied by fisharebest on topic Search and replace
> How can I make the same changes in it?.

You could put all this in a custom theme (which is much easier now).

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • Shemwell
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 8 months ago #9 by Shemwell
Replied by Shemwell on topic Search and replace
Maybe easier for some.... If I took the xenea theme and restricted Search and replace for Administrators only, how would you do it?.... please.

Barry

Please Log in or Create an account to join the conversation.

  • fisharebest
  • Away
  • Administrator
  • Administrator
More
8 years 8 months ago #10 by fisharebest
Replied by fisharebest on topic Search and replace
> how would you do it?

By waiting until 1.7.0 is released.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • Shemwell
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 8 months ago #11 by Shemwell
Replied by Shemwell on topic Search and replace
I impatiently await it's arrival. If all the custom modules were available I'd already be showing it off.

Barry

Please Log in or Create an account to join the conversation.

  • thomas52
  • Offline
  • Premium Member
  • Premium Member
  • Western North Carolina
More
8 years 8 months ago #12 by thomas52
Replied by thomas52 on topic Search and replace
Welcome to the club, Shemwell. The only problem is, with something like this, the hurrieder we go, the behinder we get.
We normally get updates every 3-4 months, but this one is a major revision and 6 months & counting.
I expect it will be worth the wait.
(In the meantime, you can always try the beta version, if you don't mind a few bugs.)

"Failure is an amazing teacher." (L'échec est un professeur extraordinaire.)

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum
}