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.
  • Page:
  • 1

TOPIC:

Search and replace 5 years 9 months ago #1

  • Shemwell
  • Shemwell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 206
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.

Search and replace 5 years 9 months ago #2

  • Jackie
  • Jackie's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 4755

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
//========== Search and replace Search Form ==========
		if ($controller->action == "replace") {
			if (WT_USER_CAN_EDIT) {

BY
//========== Search and replace Search Form ==========
		if ($controller->action == "replace") {
			if (WT_USER_CAN_ADMIN) {

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

Last edit: by Jackie.

Search and replace 5 years 9 months ago #3

  • Shemwell
  • Shemwell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 206
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.

Search and replace 5 years 9 months ago #4

  • fisharebest
  • fisharebest's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 14491
The check should be
if (Auth::isAdmin()) { ... }

You might also want to remove it from the menu (in the theme).
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

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

Search and replace 5 years 9 months ago #5

  • Shemwell
  • Shemwell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 206
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.

Search and replace 5 years 9 months ago #6

  • fisharebest
  • fisharebest's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 14491
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 - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

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

Search and replace 5 years 9 months ago #7

  • Shemwell
  • Shemwell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 206
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.

Search and replace 5 years 9 months ago #8

  • fisharebest
  • fisharebest's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 14491
> 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 - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

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

Do you need a web hosting solution for your webtrees site?
If you prefer a host that specialises in webtrees, the following page lists some suppliers able to provide one for you: 

Search and replace 5 years 9 months ago #9

  • Shemwell
  • Shemwell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 206
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.

Search and replace 5 years 9 months ago #10

  • fisharebest
  • fisharebest's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 14491
> how would you do it?

By waiting until 1.7.0 is released.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

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

Search and replace 5 years 9 months ago #11

  • Shemwell
  • Shemwell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 206
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.

Search and replace 5 years 9 months ago #12

  • thomas52
  • thomas52's Avatar
  • Away
  • Premium Member
  • Premium Member
  • Western North Carolina
  • Posts: 912
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.

  • Page:
  • 1
Powered by Kunena Forum